So i have a makefile here that looks something like
ALL_FILES=$(shell find . -name '*')
install : $(ALL_FILES)
$(INSTALL_LOCATION)/%.sh : %.sh ; /bin/usr/install -D $^ $@
$(INSTALL_LCOATION)/% : % ; /usr/bin/install -D $^ $@
$(INSTALL_LOCATION)/dir1/% : dir1/% ; /usr/bin/install -D $^ $@
my question here is , the second install there is obviously a superset of the first one,
but i guess the first one is ran first so the second one is ignored.
however, wouldnt the second one also be a full superset of the third one?
so how does make choose which rule to use? does it choose the most speicifc rule?
Depends on the version of make. For example, in GNU make prior to 3.82, it would search the patterns in the order they were declared and simply use the first pattern that matched, regardless of specificity. In 3.82 and later, GNU make uses the most specific rule, regardless of declaration order. Here’s a simple example:
Compare the output with gmake 3.81 and gmake 3.82: