4 ms·
For this reason and others I just wrote my own build script using /bin/sh: https://github.com/chkoreff/Fexl/blob/master/build https://github.com/chkoreff/Fexl/
by fexl 13y ago
For this reason and others I just wrote my own build script using /bin/sh:
https://github.com/chkoreff/Fexl/blob/master/build https://github.com/chkoreff/Fexl/blob/master/build
Configurable with a small src/config file:
https://github.com/chkoreff/Fexl/blob/master/src/config https://github.com/chkoreff/Fexl/blob/master/src/config
It automatically greps header dependencies, caching them in obj/*.i files.
- alextingle 13y agoGCC already does this for you (with the -M... options that others have mentioned). Don't re-invent the wheel. .i is the extension for pre-processed C source. If you re-use it for something else build-related, I guarantee you'll regret it.
- fexl 13y agoThanks. I'm not using make, so I don't really need a make rule, but I can see that gcc -M does something useful: $ gcc -M src/value.c value.o: src/value.c src/memory.h src/value.h The result of my grep/sed gives me just the header dependencies alone, which is really all I need: $ cat obj/value.i src/memory.h src/value.h So I might consider replacing the grep/sed with gcc -M, and strip off the first two entries, which would give me the equivalent result, but it doesn't strike me as a "must do" right now. Again, I don't use make, just /bin/sh, so I don't need a make rule per se. Thanks for the advice about the ".i" suffix. I don't think there's a conflict though, because all my intermediate files go into a completely separate "obj" directory, and no pre-processed source will be going there. However, I will consider choosing a different suffix just for the heck of it. I'm sure anything I choose (such as ".dep" or ".inc") will mean something to somebody somewhere, but since I'm in the entirely orthogonal context of the "obj" directory I don't think it matters.
- alextingle 13y agoEverbody seems to use .dep, FWIW.
- fexl 13y agoDone. https://github.com/chkoreff/Fexl/commit/ce1d0f596ab3043e0edf53a9e08af0e3557c505f https://github.com/chkoreff/Fexl/commit/ce1d0f596ab3043e0edf...