{"id":13514074,"url":"https://github.com/kala13x/smake","last_synced_at":"2026-01-30T17:36:50.906Z","repository":{"id":91015069,"uuid":"58126309","full_name":"kala13x/smake","owner":"kala13x","description":"Automatically generate Makefile by only typing smake in the project","archived":false,"fork":false,"pushed_at":"2023-12-06T22:28:52.000Z","size":385,"stargazers_count":29,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T02:34:54.295Z","etag":null,"topics":["c","cpp","makefile","makefile-generation","makefile-generator","makefile-snippets","makefile-syntax","makefile-template","makefiles","smake"],"latest_commit_sha":null,"homepage":"","language":"C","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/kala13x.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":"2016-05-05T11:30:24.000Z","updated_at":"2025-02-23T04:09:22.000Z","dependencies_parsed_at":"2023-12-06T23:27:39.689Z","dependency_job_id":"82a6b11f-1d20-4eef-bd93-80504535f9a5","html_url":"https://github.com/kala13x/smake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kala13x/smake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kala13x%2Fsmake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kala13x%2Fsmake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kala13x%2Fsmake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kala13x%2Fsmake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kala13x","download_url":"https://codeload.github.com/kala13x/smake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kala13x%2Fsmake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28916265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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","cpp","makefile","makefile-generation","makefile-generator","makefile-snippets","makefile-syntax","makefile-template","makefiles","smake"],"created_at":"2024-08-01T05:00:45.474Z","updated_at":"2026-01-30T17:36:50.880Z","avatar_url":"https://github.com/kala13x.png","language":"C","funding_links":[],"categories":["libxutils - Cross-platform C library release 2.x"],"sub_categories":["Installation"],"readme":"[![MIT License](https://img.shields.io/badge/License-MIT-brightgreen.svg?)](https://github.com/kala13x/smake/blob/main/LICENSE)\n[![C/C++ CI](https://github.com/kala13x/smake/actions/workflows/make.yml/badge.svg)](https://github.com/kala13x/smake/actions/workflows/make.yml)\n[![SMake Tests](https://github.com/kala13x/smake/actions/workflows/tests.yml/badge.svg)](https://github.com/kala13x/smake/actions/workflows/tests.yml)\n[![CodeQL](https://github.com/kala13x/smake/actions/workflows/codeql.yml/badge.svg)](https://github.com/kala13x/smake/actions/workflows/codeql.yml)\n\n## Simple-Make\n`SMake` is a simple tool that helps developers automatically generate `Makefile` for C/C++ projects by only typing `smake` in the project directory. See the file `src/info.h` to check out what release version you have.\n\n### Installation\nUse included scripts to build and clean the project.\n\n```bash\ngit clone https://github.com/kala13x/smake.git --recursive\ncd smake \u0026\u0026 ./build.sh --install --cleanup\n```\n\n### Usage\nTo use the `Makefile` generator you need to go into your project directory and type `smake`, it will automatically try to scan the project and generate the `Makefile` for you.\n\nHere is a brief overview of all available command line arguments that `smake` supports:\n\n* `-f \u003c'flags'\u003e` - Specify compiler flags.\n* `-l \u003c'libs'\u003e` - Specify libraries to be linked with your program.\n* `-L \u003c'libs'\u003e` - Specify custom libraries (LD_LIBS).\n* `-c \u003cpath\u003e` - Set the path to the config file.\n* `-b \u003cpath\u003e` - Set the install destination for the binary.\n* `-i \u003cpath\u003e` - Set the install destination for the includes.\n* `-e \u003cpath\u003e` - Exclude specific files or directories.\n* `-o \u003cpath\u003e` - Set the object output destination.\n* `-p \u003cname\u003e` - Set the program or library name.\n* `-s \u003cpath\u003e` - Set the path to the source files.\n* `-V` - Print version and exit.\n* `-I` - Initialize a new project.\n* `-j` - Generate a config file.\n* `-d` - Enable the use of a virtual directory.\n* `-v` - Adjust the verbosity level of the output.\n* `-x` - Use the CPP compiler.\n* `-h` - Print version and usage information.\n\nEach argument is optional and can be used in combination with others to suit your project's specific needs.\\\nPlease ensure you replace the placeholders (\u003c'flags'\u003e, \u003cpath\u003e, etc.) with actual values relevant to your project.\n\nFor example, if your project requires `lrt` and `lpthread` linking and you need to compile it with `-Wall` flag, the command will be the following:\n```bash\nsmake -f '-Wall' -l '-lrt -lpthread'\n```\n\nWith option `-p`, you can specify program name for your project, if you run `smake` without this argument, smake will scan your files to search `main` function and your program name will be that filename where `main()` is located.\n\nAlso if you specify the program name with `.a` or `.so` extensions (`smake -p example.so`), smake will generate `Makefile` to compile your project as the static or shared library.\n\nThis is an example of generating `Makefile` for a static library and specifying the install location for the library and headers:\n```bash\nsmake -p mylib.a -l '-lpthread' -b /usr/lib -i /usr/include\n```\n\nThe `Makefile` of this project is generated with the command:\n```bash\nsmake -jw \\\n    -o ./obj \\\n    -b /usr/bin \\\n    -e './xutils' \\\n    -l '-lpthread' \\\n    -L './xutils/build/lib/libxutils.a' \\\n    -f '-g -O2 -Wall -I./xutils/build/include' \\\n```\n\nWith argument `-j` it also generates the `json` config file, which can be used in the future to avoid using command line arguments every time.\n\nThe config file was generated and used by this project.\n```json\n{\n    \"build\": {\n        \"flags\": \"-g -O2 -Wall\",\n        \"libs\": \"-lpthread\",\n        \"ldLibs\": \"./xutils/build/lib/libxutils.a\",\n        \"outputDir\": \"./obj\",\n        \"overwrite\": true,\n        \"name\": \"smake\",\n        \"cxx\": false,\n        \"verbose\": 0,\n\n        \"includes\": [\n            \"./src\",\n            \"./xutils/build/include\"\n        ],\n\n        \"excludes\": [\n            \"./xutils\"\n        ]\n    },\n\n    \"install\": {\n        \"binaryDir\": \"/usr/bin\"\n    }\n}\n```\n\nAnything that can be passed as an argument can also be parsed from the config file. `SMake` will search the config file at a current working directory with the name `smake.json` or you can specify the path for the file with the argument `-c`.\n\nExample:\n```json\n{\n    \"build\": {\n        \"name\": \"myproj.a\",\n        \"outputDir\": \"./obj\",\n        \"flags\": \"-g -O2 -Wall\",\n        \"libs\": \"-lpthread\",\n        \"compiler\": \"gcc\",\n        \"overwrite\": true,\n        \"verbose\": 2,\n        \"cxx\": false,\n\n        \"excludes\": [\n            \"./examples\"\n            \"./cmake\"\n        ],\n\n        \"find\": {\n            \"libssl.so:libcrypto.so\": {\n                \"found\": {\n                    \"append\" : {\n                        \"path\": \"/usr/local/ssl/lib:/usr/local/ssl/lib64\",\n                        \"flags\": \"-D_PROJ_USE_SSL\",\n                        \"libs\": \"-lssl -lcrypto\"\n                    }\n                }\n            },\n\n            \"libz.so\": {\n                \"found\": {\n                    \"append\" : {\n                        \"flags\": \"-D_PROJ_USE_LIBZ\",\n                        \"libs\": \"-lz\"\n                    }\n                }\n            },\n\n            \"any_file.txt\": {\n                \"path\": \"/opt/examples/smake\",\n                \"thisPathOnly\": true,\n                \"insensitive\": false,\n                \"recursive\": false,\n\n                \"found\": {\n                    \"append\" : {\n                        \"flags\": \"-D_OPTIONAL_FLAGS\",\n                        \"libs\": \"-loptional -lexample\"\n                    }\n                },\n\n                \"notFound\": {\n                    \"append\": {\n                        \"flags\": \"-D_NO_OPTIONAL_FLAGS\",\n                    },\n\n                    \"set\": {\n                        \"libs\": \"-lonlythis\"\n                    }\n                }\n            }\n        }\n    },\n\n    \"install\": {\n        \"binaryDir\": \"/usr/lib\",\n        \"headerDir\": \"/usr/include/myproj\"\n    }\n}\n```\n\nAs you can see in the example above, `find` JSON object can be used to find files and libraries in the system. Each entry in the find section is a key-value pair where the key is the file (or a colon-separated list of files) you want to locate and the value is another object describing how to handle the dependency.\n\nThe keys in the nested objects describe how `smake` should handle each dependency:\n\n- `path` (optional): A colon-separated list of directories where `smake` should look for the files. If a file is found in these directories, the corresponding flags and libs will be applied.\n- `thisPathOnly` (optional): If set to true, smake will only look for the file in the specified path and not in the default locations.\n- `insensitive` (optional): If set to true, the file search will be case-insensitive.\n- `recursive` (optional): If set to true, smake will search recursively in the directories specified by path.\n\nIn the example above, `smake` will try to find `libssl.so` and `libcrypto.so` in either `/usr/local/ssl/lib` or `/usr/local/ssl/lib64`, if both of them are found, it will append `-D_PROJ_USE_SSL` to the compiler flags and `-lssl -lcrypto` to the linked libraries. The options for `libz.so` and `any_file.txt` are handled in a similar manner, with the additional `thisPathOnly`, `insensitive`, and `recursive` options.\n\nWithout `thisPathOnly` option, `smake` will first look for files in the provided `path`. If not found there, it will search in the following default locations:\n\n- `/lib`\n- `/lib64`\n- `/usr/lib`\n- `/usr/lib64`\n- `/usr/local/lib`\n- `/usr/local/lib64`\n\n### Initialize the project\n```bash\nsmake -I\n```\nWhen running the above command, `smake` will generate a \"Hello, World!\" project in the current working directory. The name of the project will be the same as the name of the current working directory. If you wish to provide a custom name for the executable, you can do so by passing the name as an argument using `-p`.\n\nAny remaining arguments can also be used to initialize the project, for example:\n```bash\nsmake -I -f '-Wall' -p test\n```\nThe following command will create a compilable `test.c` file in the current working directory with \"Hello, World!\" content inside and a `Makefile` that compiles the project with `-Wall` flag.\n\n### Feel free to fork\nYou can fork, modify and change the code under the MIT license. The project contains a LICENSE file to see the full license description.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkala13x%2Fsmake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkala13x%2Fsmake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkala13x%2Fsmake/lists"}