Last active
July 28, 2019 02:58
-
-
Save tapih/e2fe4ba250023282c147a4710804c56d to your computer and use it in GitHub Desktop.
example of GNU make builtin functions
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
YAML:=hoge.yaml | |
FILES:=$(YAML) fuga.tar.gz ./foo/bar.json | |
all: \ | |
abspath \ | |
addprefix \ | |
addsuffix \ | |
basename \ | |
dir \ | |
notdir \ | |
realpath \ | |
subst \ | |
shell \ | |
info \ | |
warning \ | |
if \ | |
foreach | |
.PHONY: \ | |
all \ | |
abspath \ | |
addprefix \ | |
addsuffix \ | |
basename \ | |
dir \ | |
notdir \ | |
realpath \ | |
subst \ | |
shell \ | |
info \ | |
warning \ | |
if \ | |
foreach | |
abspath: | |
@echo $@ | |
@echo $(abspath .) | |
@echo | |
addprefix: | |
@echo $@ | |
@echo $(addprefix xxx,$(FILES)) | |
@echo | |
addsuffix: | |
@echo $@ | |
@echo $(addsuffix xxx,$(FILES)) | |
@echo | |
basename: | |
@echo $@ | |
@echo $(basename $(FILES)) | |
@echo | |
dir: | |
@echo $@ | |
@echo $(dir $(FILES)) | |
@echo | |
notdir: | |
@echo $@ | |
@echo $(notdir $(FILES)) | |
@echo | |
realpath: $(YAML) | |
@echo $@ | |
@echo $(realpath $(FILES)) | |
@echo | |
subst: | |
@echo $@ | |
@echo $(subst .json,.txt,$(FILES)) | |
@echo | |
shell: | |
@echo $@ | |
@echo $(shell ls) | |
@echo | |
info: | |
@echo $@ | |
@echo $(info "this function is for print debug of Makefile") | |
@echo | |
warning: | |
@echo $@ | |
@echo $(warning "warning") | |
@echo | |
foreach: | |
@echo $@ | |
@echo $(foreach f,$(FILES),"$(f)\n") | |
@echo | |
if: | |
@echo $@ | |
@echo $(if a,not empty,empty) | |
@echo $(if ,notempty,empty) | |
@echo | |
$(YAML): | |
touch $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment