makengine is a command-line tool designed to simplify the process of compiling and executing C programs. It provides a streamlined interface for building projects using makefile and directly compiling single C files.
- Automatic Makefile Execution: If a
makefileis present in the directory,makenginewill automatically use it to build and execute the project. - Single C File Compilation: Directly compile and execute single C files.
To install makengine, clone the repository and compile the source code:
git clone https://github.com/Nash115/makengine.git
cd makengine
makeImportant
If you want to use makengine globally, you may need to add the makengine directory to your PATH environment variable.
You can do this by adding the following line to your ~/.zshrc file (or equivalent):
You also need to set the MAKENGINE_REPO_PATH environment variable to the makengine directory.
Replace the ... with the actual path to the makengine directory where you cloned the repository.
export PATH="$HOME/.../.../makengine:$PATH"
export MAKENGINE_REPO_PATH=$HOME/.../.../makengineIf you already have makengine installed, you can fetch and pull the latest changes and then run:
makengine updateRun makengine with the desired command or file path:
makengine < command / path / c file >- No command: Make (using the
makefile) and execute the program in the current directory (and then cleans). update: Updatemakengine(needs theMAKENGINE_REPO_PATHenvironment variable).<path>: Moves to the specified path, makes (using themakefile), and executes the program (and then cleans and returns to the initial working directory).<c file>: Compile (usinggcc) and execute the C file (and then cleans).init <path (optional)>: Initialize a newmakefileand a newcfile in the specified path. If no path is provided, it will create the files in the current directory. The default name for thecfile ismain.c(a simple Hello World file). Themakefilewill be created with a simple template.
-v,--version: Show version information.-h,--help: Show help information.-nc,--no-clean: Do not clean up the build files after execution.-ne,--no-exec: Do not execute the program after building. Using this option,makenginewill not clean after execution. You can use-fcto force clean the build files.-fc,--force-clean: Force clean the build files before executing. By defaultmakenginewill clean after execution, but this option is useful if you want to clean the build files while you are using-neoption.-ifn <name>,--init-file-name <name>: Set the name of thecfile to be created when using theinitcommand. The default name ismain.c.--make-args <args>: Pass args to make--exec-args <args>: Pass args to the executable-ct,--clear-terminal: Clear the terminal before each execution.
You can create a configuration file named makengine.conf in any directory. By executing makengine in this directory, makengine will use the configuration file to set the default options. (They could be overridden by the command line options). The configuration file is a simple text file with the following format:
# makengine configuration file
setting_no_clean = <0 or 1 (or -1 for default)>
setting_no_exec = <0 or 1 (or -1 for default)>
- To compile and run a C file:
makengine example.c
- To use the
makefilein the current directory:makengine
- To display version information:
makengine --version
- To update
makengine:makengine update
