ReMake implements a subset of Make in Python 2.7
First, clone the respository. Our project does not require any additional installs from pip so the requirements.txt is blank. remake.py is the file that should be run by the user. graph.py and makefile.py contain classes used in the implementation, but are not to be run by the user. To be able to run remake.py anywhere, you can add the remake directory to your path. For example, in csh you can run setenv PATH PATH_TO_REMAKE_DIRECTORY\:$PATH.
Here is the usage function for remake.py:
usage: remake.py [-h] [-f FILE] [-n] [target]
positional arguments:
target target in the makefile to run
optional arguments:
-h, --help show this help message and exit
-f FILE, --file FILE makefile to use
-n, --just-print Don't run commands. Only print them.
For example, if you go to a directory with a Makefile, then running remake.py is similar to running make. If there are multiple Makefiles in a given directory then you can specify the file which you desire to use by running, for example, remake.py -f Makefile-1.
- Correct build order and cycle detection
- Commands are only executed when needed
- Basic variables. For example:
CXX = gcc - Specific targets. For example:
remake.py cleanorremake.py target
For a reference to Makefile syntax support, see test/test_2/Makefile. This is a modified makefile from Unix class.
| Num. of Rules | ReMake Time (s) | Make Time (s) | ReMake Mem (MB) | Make Mem (MB) |
|---|---|---|---|---|
| 1 | 0.044992 | 0.002998 | 5.570312 | 0.925781 |
| 10 | 0.066989 | 0.012997 | 5.574219 | 0.945312 |
| 100 | 0.276957 | 0.114982 | 5.656250 | 1.113281 |
| 1000 | 2.446627 | 1.205816 | 6.324219 | 3.058594 |
| 10000 | 26.293001 | 26.341993 | 14.609375 | 22.496094 |
The programs used for benchmarking are in the bench folder. generate_makefiles.py is a Python script that generated test Makefiles with different numbers of rules. measure.cpp is a program from David Chiang that measures time and memory usage. comparisons_benchmark.sh is a shell script that runs generate_makefiles.py, compiles measure.cpp, runs Make and ReMake on each Makefile, and outputs a table displaying the results.
Here is an example Makefile generated by the script for testing 10 rules:
a3: a4
echo 3
a6: a7
echo 6
a5: a6
echo 5
a7: a8
echo 7
a8: a9
echo 8
a9: a10
echo 9
a1: a2
echo 1
a4: a5
echo 4
a2: a3
echo 2
a10:
echo 10
Tests are performed using Python's unittest framework. Travis CI is used so that the tests are run when commits are pushed. test/test_1 and test/test_2 contain Makefiles and example projects. test/test.py contains the test code. There are tests for both topological sort and Makefile execution.
To run the tests execute the following command from the remake folder:
python -m unittest discover test