-
Notifications
You must be signed in to change notification settings - Fork 0
Python based Build System
"I'm never writing another goddarn make-file!" - Jon V. Tøttrup, June 2018
The PBS offers a different kind of flexibility that a make file does not: the PBS is able to dynamically determine the build-order for our C project, based on the executable we want to build. Since every test-module must be compiled to a single individual program, a make file would end up being rather elaborate. This is not a problem when using the PBS.
The PBS currently takes two parameters: a path to a .c-file containing a main-function and the name of the binary to create.
It requires python3 in order to run.
The PBS can be run with bash using the command python3 build_c.py <main file> <output path>.
The result of running this command is a binary located at the output-path.
The PBS consists of simply the build_c.py file in the root of our project. This file contains 75 lines of python code. The code currently reads through the given .c-file marked as main and gathers the paths to that file's dependencies. Once all dependencies have been gathered, the build order is created by adding the source-files' dependencies in post-order.
It could be nice if the PBS could:
-
Build .dll / .lib files as well, instead of just binaries.
-
Build several test-programs and bundle them into a single script / executable.
-
Possibility of 'flattening' the source code to a single .c-file for submitting to grading systems, such as code-judge.