Last active
March 25, 2017 02:01
-
-
Save jacobly0/a29bfad24108e335b3399f19ad17c714 to your computer and use it in GitHub Desktop.
Dynamic makefile dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| all: create $(patsubst %.src,%.obj,$(wildcard *.src)) | |
| clean: | |
| rm -f create *.src *.obj | |
| %.obj: %.src | |
| cp $< $@ | |
| create: | |
| touch create {a,b,c}.src | |
| test -e create # make sure it fails if the file wasn't created (to prevent infinite recursion)! | |
| $(MAKE) | |
| .PHONY: all clean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| touch create {a,b,c}.src | |
| make | |
| make[1]: Entering directory '/home/jacob/Programming/makefile/dynamic-deps' | |
| cp b.src b.obj | |
| cp a.src a.obj | |
| cp c.src c.obj | |
| make[1]: Leaving directory '/home/jacob/Programming/makefile/dynamic-deps' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment