Skip to content

Instantly share code, notes, and snippets.

@themalkolm
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themalkolm/390bb8abc003af0fdee1 to your computer and use it in GitHub Desktop.
Save themalkolm/390bb8abc003af0fdee1 to your computer and use it in GitHub Desktop.
#
# Итак, упрощенный вариант для демонстрации чуда.
#
tmp := $(shell touch a.txt)
srcs := $(wildcard *.txt)
all: $(srcs)
@echo $(srcs)
clean:
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make clean
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
a.txt
#
# Поменяем местами, разницы нет.
#
srcs := $(wildcard *.txt)
tmp := $(shell touch a.txt)
all: $(srcs)
@echo $(srcs)
clean:
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make clean
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
a.txt
#
# Заменим wildcard на shell, внезапно все работает.
#
tmp := $(shell touch a.txt)
srcs := $(shell echo *.txt)
all: $(srcs)
@echo $(srcs)
clean:
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make clean
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
a.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
a.txt
#
# Банально поменяем порядок, уже не работает.
#
srcs := $(shell echo *.txt)
tmp := $(shell touch a.txt)
all: $(srcs)
@echo $(srcs)
clean:
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make clean
rm -rf *.txt
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
make: *** No rule to make target `*.txt', needed by `all'. Stop.
.-(~/Documents/projects/make_wtf)----------------------------------------------------------------------------------------------(malkolm@malkolms-MacBook-Air)-
`--> make
a.txt
#
# Судя по всему shell & wildcard вычисляются на разных стадиях.
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment