The comment for this is "the default make target entry". Could anyone explain more on this line? And why we use "default" rather than "all" here? Can I change the name to whatever I want? Thanks!
JFLAGS = -g
JC = javac
.SUFFIXES: .java .class
.java.class:
$(JC) $(JFLAGS) $*.java
CLASSES = \
Foo.java \
Blah.java \
Library.java \
Main.java
default: classes
classes: $(CLASSES:.java=.class)
clean:
$(RM) *.class
The meaning of the word "default" is "implicit", or "that if none is given". Here in makefiles, it would be if you call
>make
without a goal explicitly stated, then the first target in your makefile (other than ones starting with .
) is updated. So it makes sense for the first such target to be called "default". Yes you can change it to something else if you want to confuse everybody.
However, by convention from the Make manual, the name of the first target is already supposed to be all
. So all
is better than default
which is better than anything else.
Also, "default make target entry" is a poor comment. The proper terminology is "make goal", and to comment the target which one has named default
with "default" is a waste of characters :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.