Created
December 7, 2016 14:46
-
-
Save raidoz/a4b15bf24ba51c293a8a6367be7994d1 to your computer and use it in GitHub Desktop.
Makefile user interaction
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
# Make the clean target work without having to specify anything | |
ifneq ($(filter clean,$(MAKECMDGOALS)),) | |
IMPORTANT_PARAMETER=none | |
endif | |
ifndef IMPORTANT_PARAMETER | |
INTERACT_WITH_USER=1 | |
endif | |
ifeq ($(INTERACT_WITH_USER),1) | |
$(info IMPORTANT_PARAMETER not specified, use defaults(none)?) | |
USER_AGREES := $(shell read -p "Use defaults? [Y/n]: " REPLY ; echo $$REPLY) | |
ifeq ($(strip $(USER_AGREES)),) | |
USER_AGREES = y | |
endif | |
ifneq ($(filter Y y, $(USER_AGREES)),) | |
IMPORTANT_PARAMETER ?= none | |
else | |
$(error Build stopped!) | |
endif | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment