{"id":42377555,"url":"https://github.com/mcuntz/jams_makefile","last_synced_at":"2026-01-27T20:52:38.155Z","repository":{"id":112193668,"uuid":"191247847","full_name":"mcuntz/jams_makefile","owner":"mcuntz","description":"Provide a portable, versatile way of compiling Fortran, C, C++, and mixed projects.","archived":false,"fork":false,"pushed_at":"2022-09-17T20:10:57.000Z","size":33724,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-07T15:37:33.115Z","etag":null,"topics":["c","configuration","fortran","make","makefile"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcuntz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-06-10T21:25:38.000Z","updated_at":"2023-10-15T15:23:53.000Z","dependencies_parsed_at":"2023-05-04T05:20:32.366Z","dependency_job_id":null,"html_url":"https://github.com/mcuntz/jams_makefile","commit_stats":{"total_commits":404,"total_committers":15,"mean_commits":"26.933333333333334","dds":0.5099009900990099,"last_synced_commit":"88f58065094b06af8416aa57069ebb612886058e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcuntz/jams_makefile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fjams_makefile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fjams_makefile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fjams_makefile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fjams_makefile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcuntz","download_url":"https://codeload.github.com/mcuntz/jams_makefile/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fjams_makefile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28822235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","configuration","fortran","make","makefile"],"created_at":"2026-01-27T20:52:33.808Z","updated_at":"2026-01-27T20:52:38.150Z","avatar_url":"https://github.com/mcuntz.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# This is the JAMS Makefile project for Fortran, C, C++, and mixed projects.\n\nThe project provides a portable, versatile way of compiling Fortran, C, C++, and mixed projects.  \ncfortran.h can be used for Fortran-C interoperability.  \n\nCreated November 2011 by Matthias Cuntz  \nwhile at the Department Computational Hydrosystems, Helmholtz Centre\nfor Environmental Research - UFZ, Permoserstr. 15, 04318 Leipzig,\nGermany  \nand continued while at Institut National de Recherche en Agriculture,\nAlimentation et Environnement (INRAE), Nancy, France.\n\nIt is distributed under the MIT License (see LICENSE file and below).\n\nCopyright (c) 2011-2020 Matthias Cuntz - mc (at) macu (dot) de\n\n\n---------------------------------------------------------------\n\n### Description\n\nCompiling a program from source code is an elaborate process. The compiler has to find all\nsource files, of course. It has to know all dependencies between the source files. For C programs,\nit has to find all the header (.h) files. For Fortran programs, it has to find the module (.mod)\nfiles, which are produced by the compiler itself, which means that the files have to be compiled\nin a certain order. Last but not least, the compiler and linker have to find external libraries\nand use appropriate compiler options.\n\nDifferent solutions exist for this problem, the two most prominent being GNU's configure and\nKitware's CMake. One almost always has to give non-standard directories on\nthe command line, e.g.\n\n    configure --with-netcdf=/path/to/netcdf\n    cmake -DCMAKE_NETCDF_DIR:STRING=/path/to/netcdf\n\nTherefore, one has to know all installation directories, configure and cmake options, etc. for the\ncurrent computer (system), or load the appropriate, matching modules, which is tedious if you or a\nteam work on several computers such as your local computer for development and one or two clusters\nor supercomputers for production. This can be externalised in CMake by giving a script with -C or\n-P once all information was gathered.\n\nThis Makefile project follows a similar idea that the information about the current computer (system)\nmust only be gathered once and stored in a config file. The user can then easily compile the same code\non different computer (systems) with different compilers in debug or release mode, by simply\ntelling on the command line, for example:\n\n    make system=mcinra compiler=gnu release=debug\n\nThis uses the system specific files _mcinra.alias_ to look for the default GNU compiler, which is\nversion 9.2 in this case and then uses all variables set in the file _mcinra.gnu92_. The user has\nto provide _mcinra.alias_ and _mcinra.gnu92_ populated with the directories and specific compiler\noptions for the GNU compiler suite 9.2 on the macOS system _mcinra_. Checking the same code with\nanother compiler would be (given _mcinra.intel*_ exists):\n\n    make system=mcinra compiler=intel release=debug\n\nAfter checking with debug compiler options, one can simply compile the release version of the program by typing:\n\n    make system=mcinra compiler=intel release=release\n\nOnce _mcinra.alias_ and _mcinra.gnu92_  are setup, they can be reused for every other project on the computer (system) _mcinra_.\n\nThe project includes examples for different operating systems, i.e. Unix (e.g. _pearcey_),\nLinux (e.g. _explor_), macOS (e.g. _mcinra_), and Windows (e.g. _uwin_). The system _mcinra_\nprovides examples for different compilers, i.e. the GNU compiler suite, the Intel compiler suite,\nthe NAG Fortran compiler, and the PGI Fortran compiler.\n\nThe project provides some standard configurations for the GNU compiler suite such as\n_homebrew_ on macOS, _ubuntu_ on Linux, and _cygwin_ and ubuntu (_uwin_) on Windows.\n\n\n---------------------------------------------------------------\n\n### How to use\n\nThe library is maintained with a git repository at:\n\n    https://github.com/mcuntz/jams_makefile/\n\nTo use it, checkout the git repository:\n\n    git clone https://github.com/mcuntz/jams_python.git\n\nOpen the file _Makefile_ and make the proper settings for your source code\n(compiler, release, netcdf, openmp, mpi, lapack, etc.). Read the header of the _Makefile_ for targets, etc.\n_make info_ gives detailed information. Then run _make_:\n\n    make\n\nYou can give most makefile switches on the command line as well because they are simply variables, e.g.:\n\n    make system=mcair compiler=gnu netcdf=netcdf4\n\nYou might have to setup your computer (system) and compilers first\n(see below). You might also use some generic setups with the GNU\ncompiler suite such as _homebrew_ on macOS (everything in /usr/local), _ubuntu_ on Linux\n(/usr), and _cygwin_ and ubuntu (_uwin_) on Windows (/usr).\n\n\n---------------------------------------------------------------\n\n### Notes\n\n1. The makefile provides dependency generation using the Python script\n   _make.config/make.d.py_. Dependency generation must be done in serial. Parallel make (-j) does\n   hence not work from scratch.  \n   One can split dependency generation and compilation by first calling make with a dummy target,\n      which creates all dependencies, and then second calling parallel make with the -j switch,\n      i.e.:\n\n        make      system=mcinra compiler=intel release=release  dum\n        make -j 8 system=mcinra compiler=intel release=release\n\n2. The static switch is maintained like a red-headed stepchild. Libraries might be not ordered\n   correctly if static linking and --begin-group/--end-group is not supported by the linker.\n\n3. C- and C++-file dependencies are generated with:\n\n        $(CC) -E $(DEFINES) -MM\n\n\n---------------------------------------------------------------\n\n### Example\n\nMixed project with Fortran and C code using revision system git, and used on different\ncomputer systems. The Fortran code is in the subdirectory _src/fortran_ and the C code in _src/c_.\n\n- Copy file _Makefile_ and directory _make.config_ into project home.\n\n- Edit _Makefile_ giving the directories with the source files, a sensible PROGNAME, and setting\n  appropriate libraries such as netcdf, openmp and/or mpi:\n\n        SRCPATH := src/fortran src/c\n        PROGNAME := myproject\n\t\tnetcdf := netcdf4\n\t\tlapack := true\n\n- Debug project on computer with system with name, for example, _mcinra_:\n\n        make system=mcinra compiler=gnu release=debug   \u0026\u0026   ./myproject\n\n- Added new _use module, only: func_ in one of the Fortran source files: one has to re-generate\n  dependencies first:\n\n        make system=mcinra compiler=gnu release=debug   depend\n        make system=mcinra compiler=gnu release=debug   \u0026\u0026   ./myproject\n\n- Debug further with other compilers:\n\n        make system=mcinra compiler=intel release=debug   \u0026\u0026   ./myproject\n        make system=mcinra compiler=nag release=debug   \u0026\u0026   ./myproject\n\n- Produce fast release version:\n\n        make system=mcinra compiler=intel release=release   \u0026\u0026   ./myproject\n\n- Clean the project and commit everything to revision system (use target _distclean_ to clean\n builds with several compilers or debug and release code; target _clean_ removes only code from\n current compiler and build):\n\n        make system=mcinra compiler=intel release=release    distclean\n        git add Makefile make.config\n        git commit -a -m \"Debugged project with different compilers\" \u0026\u0026 git push\n\n- Checkout the project on deployment machine, for example, _explor_:\n\n        git clone https://github.com/mcuntz/project.git\n        cd project\n        make system=explor compiler=intel release=release\n\n- Run the program.\n\n        qsub submit_myproject.sh\n\nNote, for faster parallel builds, the above make command can be split\nin two (see Note 1), which is expedient for large code bases:\n\n    make      system=explor compiler=intel release=release   dum\n    make -j 8 system=explor compiler=intel release=release\n\n\n---------------------------------------------------------------\n\n### How to add a new compiler on a given system\n\nAs an example, one wants to add the PGI compiler suite version 19.10 on\nthe system _eve_.  \nChoose the compiler abbreviation _pgi1910_, i.e. leading to _system=eve compiler=pgi1910_.\n\n1. Create a config file in _make.config/_ with the name _eve.pgi1910_.  \n One can copy an existing file and adapt it to the new compiler.  \n Take a compiler close to the new one, e.g. _eve.pgi83_ or _mcinra.pgfortran194_.  \n If there is none, take _explor.gnu63_ on a Linux system and _mcinra.gnu92_ on macOS as good starting\n points.\n2. Adapt the directories and compiler switches in the config file.\n3. If wanted, you can give aliases for that compiler, e.g. simply _pgi_ instead of the name\n including the version number _pgi1910_.  \n Edit _eve.alias_, follow the examples of _pgfortran_ or _intel_.\n\n\n### How to port the Makefile to a new computer (system)\n\nAs an example, one wants to port the Makefile onto a new system called _Liclus_\non which exists a GNU compiler version 4.7, i.e. leading to _system=liclus compiler=gnu47_.\n\n1. Create a config file in _make.config/_ with the name _liclus.gnu47_.  \n One can copy an existing file of a similar system and a similar compiler.  \n For example if Liclus is macOS, then _mcinra.gnu92_ might be a good start and if Liclus is Linux\n then _explor.gnu63_ might give a head start.\n2. Adapt the directories and compiler switches in the config file.\n3. One can give aliases for that compiler, e.g. simply _gnu_ instead of the name\n including the version number _gnu47_.  \n Therefore a file _liclus.alias_ is needed. Create it in _make.config/_;  even an empty one is\n possible if no aliases are wanted. One can copy _explor.alias_ or _mcinra.alias_ for examples.\n\n\n---------------------------------------------------------------\n\n###  License\n\nThis file is part of the JAMS Makefile system, distributed under the MIT License.\n\nCopyright (c) 2011-2020 Matthias Cuntz - mc (at) macu (dot) de\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcuntz%2Fjams_makefile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcuntz%2Fjams_makefile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcuntz%2Fjams_makefile/lists"}