Need to ensure a certain binary is built early and excluded from clean
0
votes
1
answer
79
views
Trying to run this code in my Makefile:
MAKEFLAGS+=--no-buildin-rules
MAKEVARIABLES+=--no-builtin-variables
fixClean: dissoc.c
echo "Inside fixClean"
${CC} $ make clean
make clean
make: dissoc: No such file or directory
make: dissoc: No such file or directory
make: dissoc: No such file or directory
make: dissoc: No such file or directory
echo "Inside fixClean"
Inside fixClean
gcc dissoc.c.c "-lcrypt" -o dissoc
cc1: fatal error: dissoc.c.c: No such file or directory
compilation terminated.
make: *** [Makefile:24: fixClean] Error 1
dissoc is needed by the Makefile.
It dissociates groups from group of undesired patterns.
It is needed by all targets: all, db, clean.
I want to exclude it from clearing, or at least rebuild it right after.
Also, make's default rules are wreaking havoc.
Is there anything more to do about them?
---
Let me explain a bit about dissoc. It is short for dissociation. It runs as a shell command:
TSRC=$(widlcard *.c) => about 37 files in the directory SLIBS=utils.c hash.c dsp.c logs.c fftw.c usrp.c decoder.c => 7 files These are static libs without a main function. CSRC=$(shell dissoc ${TSRC} \\ ${SLIBS}) \\ is the group separator. EXEC=$(basename ${CSRC}) ${OBJ}In EXEC I need only the 37-7= 30 cfiles. dissoc checks each file in TSRC (temporary sources) against SLIBS and removes it if it is a static library. SLIBS are processed through other patterns (basename, addsuffix) to generate the OBJ group. The idea is to remove the pattern clutter in Makefiles by reducing explicit patterns. SLIBS, static libs are still explicit, I guess I could check them automatically by looking for an "int main(" I've tried the make -d output and it is overwhelming. Testing patterns against an infinite group of legacy and new patterns? Not maintainable. A flex approach would be much simpler. On error it just reports the Makefile line number that matched, and the state that it happened. If the pattern work is heavy, a bison could be implemented as a back end.
Asked by Nibal
(11 rep)
Apr 24, 2025, 07:15 PM
Last activity: Apr 26, 2025, 06:27 AM
Last activity: Apr 26, 2025, 06:27 AM