Created
October 15, 2024 04:59
-
-
Save jordansissel/23b15c7fed9dad48017283fd65d068a5 to your computer and use it in GitHub Desktop.
Non-file dependencies in a Makefile
This file contains 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
# 'gem list -i foo' will print 'true' if a gem is already installed. 'false' otherwise | |
GEMS=clamp rake | |
# From the GEMS list, generate a list of make targets | |
TARGETS=$(foreach gem,$(GEMS),gem-$(shell gem list -i $(gem))-$(gem)) | |
build: $(TARGETS) | |
build: | |
@echo "=> OK to build" | |
.PHONY: gem-false-% | |
gem-false-%: GEM=$(@:gem-false-%=%) | |
gem-false-%: | |
@echo Installing "$(GEM)" | |
gem install $(GEM) | |
.PHONY: gem-true-% | |
gem-true-%: GEM=$(@:gem-true-%=%) | |
gem-true-%: | |
@echo "Found $(GEM)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment