This tool will automatically build C code without any makefiles. It does so by searching the directory it's run in and all of its subdirectories for .c files. It then compiles them. Any unresolved include (.h) files are searched for first in its cache, then in the directory and its subdirectories, and finally, in the directories ancestors and their subdirectories. Baker will keep looking until the user's home directory is reached.
Once all code is compiled, libraries are created in any source directory that doesn't contain a program (a .c file containing a main function). Finally, any programs are linked, using a similar process as for include files to find libaries that contain symbols they require. As of May, 2016, baker will automatically reorder the link for you.
For improved performance, the rules used to compile each directory are stored in JSON format in the file baker.doh. This file can be checked in to git along with the code. If new dependencies are added, baker will detect them and modify the doh for you.
Beta: Not ready for prime time. I'm using the current version to build most personal C projects, but there are still limitations.
2017-06-24: Now look in /usr/lib for missing symbols (e.g. for libm.a math library functions)
Bring baker down from github. Include the main directory in your path or create a symbolic link to "baker" from a directory in your path. Go to the directory you want to compile and type "baker"
Run baker -h for help:
Option | Long Option | Description |
---|
-c | --clean | Remove all target directories generated by baker. If -n is specified, tell what would be cleaned.
-n | --noaction | Tells you what commands would be run, but doesn't actually build, clean, or run the code
-s | --strict | Compile with -werror => warnings are errors
-t | --test | Run any program whose name begins with "test". If -n is specified, tell what would be run.
-v | --verbose | Output addition information
You can tweak some of the values in the baker.doh files to deal with special cases.
Property | JSON Type | Description |
---|---|---|
archive | string | Name of the archive to create; defaults to target/<dir-name>.ar ; if specified in a directory that contains program and non-program object files, the non-program objects (i.e. the ones that don't define main) will be archived |
ccFlags | object | Pairs of flag and one of True (include), False (exclude), or appended value |
ignoreFiles | list | List of source files to ignore |
preferredIncludeDirExps | list | List of regular expressions; matching directory paths will be preferred for header files found in more that one directory |
preferredLibraries | list | List of library filenames that will be preferred if there is more than one containing a required symbol |
systemLibraryFlags | string | A string of system library flags to be appended to the link (e.g. -lm for the math libary). I'd like to automate this in future. |
More will be added in future versions. See the Baker Wiki for more details.
Baker is copyrighted by Jim Belton
It is licensed under the GNU Public License, version 3. See http://www.gnu.org/licenses/gpl-3.0.en.html