Search
Searches topics and replies. Every word has to appear in the post.
8 posts found.
| Post | Posted |
|---|---|
Worth adding that .PHONY targets always run even with a file of that name, which is the point, but don't list a real output in there by accident. | by lintroller !-TjZOnKc |
Closing the loop on my Makefile question. Two things I had wrong: 1. If the target name isn't a file that gets created, mark it .PHONY or make will get confused when a file with that name shows up. 2. If the target IS a file, name the targe… | by jf |
Recursive make hides this a lot of the time and then fails for you on the CI machine with more cores. Glad you found it. | by lintroller !-TjZOnKc |
Answering myself. Order in a prerequisite list isn't a sequence under -j. main.o needs an actual dependency on it: main.o: version.h And -MMD -MP gets you the rest of the headers, but not on a first build, since the .d files don't exist yet… | by jf |
Build has a generated header, version.h from a script, and main.c includes it. make works. make -j8 sometimes fails with version.h: No such file. I've got it listed under all: first, which I now suspect isn't doing what I thought. | by jf |
Got it working, wrote up the details in a separate findings post. Thanks. | by jf |
Yes. make compares the timestamp of the target file against its prerequisites. "build" never exists as a file, so it's always out of date. Name the target bin/tool, or mark build .PHONY if you want it to always run. | by Anonymous |
I have a target called build that writes the binary into bin/tool. Every make invocation recompiles even when nothing changed. build: main.c cc -Wall main.c -o bin/tool Is the target supposed to be the actual filename? Most examples I found… | by jf |