Makefiles – Best Practices
danyspin97.org
Makefiles – Best Practices
1–10 of 127 posts
Re: Makefiles – Best Practices
#2This is pretty cool summary. Thanks.
Re: Makefiles – Best Practices
#3For those interested, there's also this writeup of making portable makefiles on nullprogram[1]
Re: Makefiles – Best Practices
#4I recently decided it was time to get a better understanding of how makefiles work, and after reading a few tutorials, ended up just reading the manual. It's long, but it's very, very well written (a good example of one of the Gnu projects biggest strengths), to the point where just starting at the top and reading gives an almost tutorial-like effect. Just read the manual!
Re: Makefiles – Best Practices
#5 CFLAGS := ${CFLAGS}
CFLAGS += -ansi -std=99
What's the point of the first line? Why not just: CFLAGS += -ansi -std=99Re: Makefiles – Best Practices
#6A particularly tricky task with GNU make is automatically adding target dependencies on header files and handling updates to them (gcc's -M and -MMD switches). It would be great if the article explained those best practices, too.
Re: Makefiles – Best Practices
#7CFLAGS := ${CFLAGS} CFLAGS += -ansi -std=99 What's the point of the first line? Why not just: CFLAGS += -ansi -std=99
My guess is that the left hand side is a make variable while the right hand side is an environment variable. However the make manual says “Every environment variable that make sees when it starts up is transformed into a make variable with the same name and value.“ so maybe it’s not necessary?...
Re: Makefiles – Best Practices
#8There are so many gotcha with makefiles yet we still use them regularly. I'm considering moving on to something like Taskfile [1], though I haven't tried it yet.
Re: Makefiles – Best Practices
#9"Makefile, Best Practices: Use CMake to generate them for you"
Re: Makefiles – Best Practices
#10CFLAGS := ${CFLAGS} CFLAGS += -ansi -std=99 What's the point of the first line? Why not just: CFLAGS += -ansi -std=99
Because CFLAGS may not be set in the environment, resulting in concatenation to an undefined variable error.