Respect CC, CFLAGS, CPPFLAGS, and LDLIBS.
CCdefaults togccCFLAGSdefaults to-std=c99 -g -O2, appended by-Wall -Wextra -pedantic
PACKAGE,VERSION, andPROGRAMPREFIXdefaults to/usr/local, andDESTDIR
debugdefaults to0,1to add-DDEBUG -O0toCPPFLAGS
cleanandclobberinstall,install-strip, anduninstalldependfor genearting.dependsbymakedepend
I don't like the following fashion for declaring phony targets, they all squeeze into a single line, it's messy.
.PHONY: all clean installIt's very likely that you would forget to add to the list or take one off if you remove a target. However, I did use it for some time until I discovered another, which I couldn't remember where I first saw this:
.PHONY: all
all: main
# do something
.PHONY: clean
clean:
$(RM) *.oIt's cleaner in my opinion, nothing wrong about it, but when I saw cmake generated in this way, I jumped the ship right away:
all: main
# do something
.PHONY: all
clean:
$(RM) *.o
.PHONY: cleanTruly, there is nothing particularly special about it, it simply moves all the declarations right after the ends of respective targets. To me, it's like closing tag of HTML, the targets line is the opening tag. It's kind of like what you see some people would add a comment after } to indicate which block to end in C:
int
foobar(void)
{
/* something */
if (dummy == c)
{
/* something */
} /* dummy == c */
} /* foobar */This is why I feel it's like closing tag.