Last active
December 18, 2015 13:18
-
-
Save techtonik/5788480 to your computer and use it in GitHub Desktop.
Using Python inside 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
# Black magic to use Python logic for setting Makefile variables | |
# Real world example that is detecting AppEngine SDK with Python | |
# Helper code to detect SDK location | |
define DETECT_SDK | |
import os | |
locations = [ | |
"../google_appengine", | |
"/usr/local/google_appengine", | |
"../.locally/google_appengine", | |
] | |
for path in locations: | |
if os.path.exists(path): | |
print(path) | |
break | |
endef | |
# /Helper | |
SDK_PATH ?= $(shell python -c '$(DETECT_SDK)') | |
default: | |
@echo 'SDK Path Detected: $(SDK_PATH)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment