Skip to content

Instantly share code, notes, and snippets.

@jeschkies
Created May 8, 2016 20:36
Show Gist options
  • Save jeschkies/614c81023c3a26d009b6eadff5e72fe1 to your computer and use it in GitHub Desktop.
Save jeschkies/614c81023c3a26d009b6eadff5e72fe1 to your computer and use it in GitHub Desktop.
Example dependency management with Make
build-deps: catch docopt
vendor:
 mkdir -p vendor
vendor/.last-build: deps.mk
 make build-deps -j4
 touch vendor/.last-build
catch: REPO = https://github.com/philsquared/Catch
catch: COMMIT = c984fc3
vendor/catch: | vendor
 git clone $(REPO) $@
catch: vendor/catch
 cd $< && git fetch && git checkout $(COMMIT)
docopt: REPO = https://github.com/docopt/docopt.cpp.git
docopt: COMMIT = a4177cc
vendor/docopt: | vendor
 git clone $(REPO) $@
docopt: vendor/docopt
 cd $< && git fetch && git checkout $(COMMIT) \
 && cmake . && make
#…
bootstrap: vendor/.last-build
# run bootstrap before building anything
*.o **/*.o: | bootstrap
clean:
rm -rf *.o lib/*.o test_assimp *.dSYM *.gcov *.gcno *.gcda genfiles $(BINS)
distclean: clean
rm -rf vendor
include deps.mk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment