Reputation: 6797
I have the following makefile :
DESTFILES = build/test1 build/toto2
build/test1: test1
cp $< $@
build/toto2: toto2
cp $< $@
all: build/test1 build/toto2
The directory in which the Makefile resides contains the build
subdirectory and the test1
, toto2
empty files.
The aim is to copy the files to the build subdirectory (a la make install
).
When I do a make all
command, the files are copied appropriately in build
.
But when I do just make
only the first target of all
, test1
is triggered and so only the first file is copied.
I am very suprised at this behavior. Can anyone enlighten me about this ?
This is with GNU Make 4.1 on Archlinux.
Upvotes: 0
Views: 90
Reputation: 29222
For GNU make, the default goal (the target that is done when you just type make
) is the first one which name does not start with '.'. all
is just a name, GNU make does not do anything special with it. If you want it to be the default, put it in first position or use the special .DEFAULT_GOAL
variable:
.DEFAULT_GOAL := all
Upvotes: 2