Created
October 3, 2014 18:33
-
-
Save bobbyno/57a3f5ce397acb5af054 to your computer and use it in GitHub Desktop.
makefile trickery
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
# Example of iterating over a list of projects | |
projects = $(shell find . -name Dockerfile -exec dirname {} \;) | |
graceful: | |
# Find all projects with a Dockerfile, then call the local-stop target | |
# on them before a vagrant halt. Makes faulty exits more explicit. | |
$(foreach p,$(projects), \ | |
make -i -C $p local-stop ;) | |
vagrant halt | |
# Example of changing a given line of a file | |
props = ./buildAgent/conf/buildAgent.properties | |
swap = /tmp/props && mv /tmp/props $(props) | |
local-build: local-props build | |
prod-build: prod-props build | |
# Changes line 8 of the build agent properties file | |
local-props: | |
awk 'NR==8 {$$0="serverUrl=http://192.168.33.10:8111"} 1' $(props) > $(swap) | |
prod-props: | |
awk 'NR==8 {$$0="serverUrl=http://build.example.com:8111"} 1' $(props) > $(swap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment