{"id":24680439,"url":"https://github.com/bragdond/makefile","last_synced_at":"2026-05-20T10:03:22.179Z","repository":{"id":44722601,"uuid":"453073830","full_name":"BragdonD/makefile","owner":"BragdonD","description":"makefile for cpp and c project of all size","archived":false,"fork":false,"pushed_at":"2022-11-11T00:49:20.000Z","size":104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T14:13:19.958Z","etag":null,"topics":["c","cpp","makefile"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BragdonD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-28T13:16:18.000Z","updated_at":"2022-10-16T01:36:08.000Z","dependencies_parsed_at":"2022-09-07T03:21:42.268Z","dependency_job_id":null,"html_url":"https://github.com/BragdonD/makefile","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BragdonD%2Fmakefile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BragdonD%2Fmakefile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BragdonD%2Fmakefile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BragdonD%2Fmakefile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BragdonD","download_url":"https://codeload.github.com/BragdonD/makefile/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244855778,"owners_count":20521704,"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","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"],"created_at":"2025-01-26T14:13:24.219Z","updated_at":"2026-05-20T10:03:17.149Z","avatar_url":"https://github.com/BragdonD.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Makefile For C++ or C project\n\n## Presentation\n\n### French 🇫🇷 \n\nDans ce dépot vous pourrez trouver des `makefiles` pour compiler vos projets codés en `c++` ou en `c` et de toutes tailles. Les makefiles sont à inclure dans le `dossier root` du projet. Afin de lancer le makefile vous pouvez utiliser la commande `mingw32-make`.\n\nComme dit plus haut il y a différents makefiles, il y a le makefile pour les petits et moyen projets, il est très utiles pour des projets n'incluant pas de sous-dossier dans les dossiers sources.\n\nEnfin il y a le makefile pour des projets de grande taille qui permet d'avoir des sous-dossiers.\n\n\n### English 🇬🇧 \n\nIn this repository you can find makefiles to compile your projects coded in c++ or in c and of all sizes. The makefiles are to be included in the base folder of the project. In order to run the makefile you can use the command mingw32-make.\n\nAs said above there are different makefiles, there is the makefile for small and medium projects, it is very useful for projects that do not include a subfolder in the source folders.\n\nFinally there is the makefile for large projects which allows to have subfolders.\n\n## Organisation du projet\n\n- src       | - *.cpp ou *.c\n- inc       | - *.hpp ou *.h\n- inc\\bits  | - *.tcc\n- bin       | - *.exe\n- obj       | - *.o et *.d\n\nCette organisation peut être modifiée en changeant les nom des dossiers dans le makefile. Attention la path des dependances et des objets doit rester la même sinon il faudra changer la manière de récupérer les dépendances égalements.\n\n## Flags to add to CXXFLAGS\n### Search and Link flags\n- `-l[lib_name]`: link a library to the program. Example: -lws2_32 to link the socket library under windows.\n- `-L[path_to_lib]`: search for additional lib into this path.\n- `-I[path_to_inc]`: search for additional include.\n- `-D[flag]`: pass preprocessor flag. Can add define to the code.\n### GCC and GDB\n#### STD Version\n- `-std=c++[version]`: fix the c++ version to use. (Same for C and gnu).\n#### Verbosity / Debug\n- `-Wall`: Turn on most of compiler warning flags.\n- `-Werror`: Turn all compiler warning into error.\n- `-W`: Turn all the flags not enabled by -Wall.\n- `-pedantic`: Issue warning relative to ISO norms.\n#### Optimization\n- `-O0`: no optimization.\n- `-O2` mid level of optimization.\n- `-O3`: higher level of optimization.\n- `-OFast`: higher than -O3.\n- `-m32`: code for 32-bit environment.\n- `-m64`: code for 64-bit environment.\n- `-finline-functions`: integrate simple function(up to the compiler to decide) into their callers.\n#### Special Options\n- `-g`: for debug purpose to use gdb. Need to be remove in deploy app.\n- `-pie`: builds a dynamically linked position independant exe.\n- `-static-pie`: builds a statically linked position independant exe.\n- `-shared`: build a shared lib (*.so file for unix, *.dll for windows).\n- `-fno-exceptions`: remove c++ exceptions.\n- `-fno-rtti`: remove run time informations\n\n## Run the project\nAfter running the makefile you can run the following command to run your project : `.\\bin\\main`\nWARNING: `main` is just the name given to the output program if you rename it then the command change too.\n\n## Reminder\nSince a makefile is not the same as an IDE you need to save the files yourself!!!!!\n\n## Resolve some bugs\nRecently when running those makefile i come with the follow errors :\n```\nmkdir obj\nprocess_begin: CreateProcess(NULL, mkdir obj, ...) failed.\nmake (e=2): The system cannot find the file specified.\nmake: *** [makefile:45 obj] Error 2\n```\nSo the source of the problem was coming from my compiler which is the MINGW project from MSYS. Inside this project the command mkdir is not present. I don't know why it was working before...\nAnyways to fix it you need to download the directory from this link : https://sourceforge.net/projects/unxutils/?source=typ_redirect and then you extract the tools necessary inside the `bin` directory of your compiler.\n\n## Bibliographie\n\n- https://stackoverflow.com/questions/2483182/recursive-wildcards-in-gnu-make\n- https://www.gnu.org/software/make/manual/html_node/File-Name-Functions.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbragdond%2Fmakefile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbragdond%2Fmakefile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbragdond%2Fmakefile/lists"}