/MakeFile-Creator

Makefiles management tool.

Primary LanguagePythonMIT LicenseMIT

MakeFile-Creator

MakeFile-Creator is an utility for managing makefiles in C/C++ projects.

Getting started

These instructions will get you a copy of the project up and running on your local machine.

Prerequisites

Python >= 3.6

Installing

Install the package from Python Package Index:

pip3 install makefile-creator

Configuration

cd /your/project/path

You have to create a configuration file. For the first time it's good to let MakeFile-Creator to automatically generate configuration for you.

python3 -m makefile_creator -config

A new mfc.config.json file will be created in current working directory.

File content should be something like this:

{
  "TARGET": "my_project",
  "CC": "gcc",
  "LD": "gcc"
  "C_FLAGS": [
    "-c",
    "-Wall"
  ],
  "LD_FLAGS": [],
  "EXTENSIONS": [
    "c",
    "cc",
    "cpp"
  ],
  "IGNORE_PATHS": [],
  "CUSTOM_TARGETS": {},
  "VERBOSE": false,
  "RM": "rm -v",
  "BUILD_DIRECTORY": "./build",
  "BIN_DIRECTORY": "./build/bin"
}

Meaning:

  • target: Project name.
  • cc: Compiler command ("gcc", by default).
  • ld: Linker command ("gcc", by default).
  • c_flags: List of compiler flags.
  • ld_flags: List of linker flags.
  • libs: Libs to be used to compile the project.
  • include_paths Paths to search for headers.
  • extensions: Source files extensions list.
  • ignore_paths: List of paths to be ignored, for example you can put here all directories you do not want MakeFile-Creator to scan.
  • custom_targets: Custom targets for make, in the following format:
"custom_targets": {
    "target_name": "command",
    "other_target": "other_command",
    ...
}"
  • verbose: true if you want to print entire source tree while scanning.
  • rm: Command to use for make clean (rm -v, by default).
  • build_directory: Path where you want to build the project.
  • bin_directory: Binary output file (e.g. where you want to put final executable).

For more details:

python3 -m makefile_creator -h

Run the script:

python3 -m makefile_creator

Now MakeFile-Creator will generate makefiles. Feel free to change this setting in mfc.config.json according to your requirements.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

  • New in version v0.0.9-beta (November 2020):

    • Added libs support (libs).
    • Added include paths support (include_paths).
    • All makefiles and deps files are now put into build directory.
    • Code refactoring.
  • New in version v0.0.8-beta (November 2020):

    • Added command line arguments. Now you can generate configuration file from command line and also update, or override settings.
    • Build files are now put in a separate directory (build_directory).
    • Added separate command for Linker (ld).
    • Other code refactoring and bugs fixed.