{"id":16270806,"url":"https://github.com/fboulnois/modern-makefile","last_synced_at":"2026-05-09T16:48:44.445Z","repository":{"id":140693319,"uuid":"286102744","full_name":"fboulnois/modern-makefile","owner":"fboulnois","description":"Set it and forget it -- throw it in a C/C++ project and type `make`","archived":false,"fork":false,"pushed_at":"2020-08-08T19:01:54.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-08T15:34:42.107Z","etag":null,"topics":["c","cpp","makefile","makefile-template"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fboulnois.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-08T18:59:31.000Z","updated_at":"2022-07-14T23:29:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"3750f89c-bee4-400e-a983-89a4dba6d54d","html_url":"https://github.com/fboulnois/modern-makefile","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fboulnois/modern-makefile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fmodern-makefile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fmodern-makefile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fmodern-makefile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fmodern-makefile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fboulnois","download_url":"https://codeload.github.com/fboulnois/modern-makefile/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fboulnois%2Fmodern-makefile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278471163,"owners_count":25992428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","cpp","makefile","makefile-template"],"created_at":"2024-10-10T18:11:40.360Z","updated_at":"2025-10-05T15:08:50.503Z","avatar_url":"https://github.com/fboulnois.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Modern Makefile for C and C++\n\nSet it and forget it -- throw it in a C/C++ project and type `make`\n\n## Motivation\n\nBuilding a C/C++ project should be as simple as typing a single command.\n\nUnfortunately, C/C++ projects often use byzantine, brittle, and bespoke\nMakefiles or instead use elaborate or exotic build systems¹.\n\nMake is a venerable, versatile, and nearly universal build system, but it is\nmissing a universal C/C++ Makefile!\n\nThe solution is a simple, reusable, and cross-platform Makefile for C/C++. It\nsupports small, medium, and large C/C++ projects in less than 130 lines of Make.\n\n## Features\n\n* Supports building mixed C and C++ projects\n* Rebuilds objects which depend on headers when headers are modified\n* Supports `make all`, `make clean`, and `make objects` out-of-the-box\n* Build flag defaults to enhance the security of executable (overridable)\n* Automatically builds everything in the current directory (overridable)\n* Automatically names the build as the parent directory (overridable)\n* Automatically builds an executable or shared library with the right file\nextension (overridable)\n* Ability to debug Makefile variables\n* Documentation for each Makefile section\n\n## Compatibility\n\nThis Makefile should work on any machine that has at least GNU Make 3.8 (from\n2002!)² and various flavors of OpenBSD and FreeBSD Make.\n\nIt has been explicitly tested on the following versions of Mac, Linux, and\nWindows:\n\n* MacOS 10.6 and later\n* Linux\n    * Ubuntu 12.04 and later\n    * Alpine 3.2 and later\n    * RHEL/CentOS 7 and later\n    * Fedora 20 and later\n* Windows 7 and later\n    * Cygwin\n    * Mingw32/64\n    * MSYS2\n    * WSL1/2\n\n## Adding includes and external libraries\n\nIncludes should be added to the `MY_CFLAGS` variable of the Makefile. For\nexample, if your program requires certain headers from `/usr/local/include`:\n\n```sh\nCFLAGS  = -I/usr/local/include\n```\n\nLibraries should be added to the `MY_LIBS` variable of the Makefile. For\nexample, if your program uses `\u003cmath.h\u003e`, you may need to link the `libm`\nlibrary:\n\n```sh\nMY_LIBS   = -lm\n```\n\nSimilarly, if you have a library in a custom path, this path should be added to\nthe `MY_LIBS` variable **before** the library:\n\n```sh\nMY_LIBS   = -L/usr/local/lib -lz\n```\n\n## Notes\n\n¹ I get sad every time I need to use CMake, Autotools, Bazel, Ninja, Premake,\nMeson, Cake, qmake, Rake, or SCons 😭 (Tup and xmake are cool but rare)\n\n² I am not sure when I originally wrote it, but I have been using it since at\nleast 2014.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffboulnois%2Fmodern-makefile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffboulnois%2Fmodern-makefile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffboulnois%2Fmodern-makefile/lists"}