I have a Makefile that has two identical targets, one for
mkdir and the other for
The Makefile creates dir when it does not exist, and then copy files. I wonder how it works. As I know, Makefile does not execute recipes line by line, from top to bottom.
Can someone explain how it works?
# Makefile SRCDIR := ../../../src SUBDIR := include HEADERS := a.hpp \ b.hpp HEADERS := $(addprefix $(SUBDIR)/, $(HEADERS)) # Copy headers in SRCDIR to SUBDIR prebuild: $(HEADERS) $(HEADERS): | $(SUBDIR) $(SUBDIR): mkdir $@ $(HEADERS): %: $(SRCDIR)/% cp $< $@
@cryptarch What I am doing is
$ make prebuild
What this Makefile should do is