dependency ladder example
This commit is contained in:
parent
4c51ade750
commit
f358103f79
1
slides/makefiles/dependency_ladder/.gitignore
vendored
Normal file
1
slides/makefiles/dependency_ladder/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*
|
16
slides/makefiles/dependency_ladder/makes/books
Normal file
16
slides/makefiles/dependency_ladder/makes/books
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
MONTHS != date +%B && date -d '1 month' +%B
|
||||||
|
IP != dig +short myip.opendns.com @resolver1.opendns.com
|
||||||
|
CITY != curl -s http://api.db-ip.com/v2/free/$(IP) | grep city | cut -d: -f2 | tr -d '"'
|
||||||
|
|
||||||
|
TITLES = $(MONTHS)
|
||||||
|
TITLES += $(CITY)
|
||||||
|
|
||||||
|
BOOKS = $(patsubst %,Books/%.md,$(TITLES))
|
||||||
|
|
||||||
|
$(BOOKS):
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
fortune -l > $@
|
||||||
|
|
||||||
|
progs += $(BOOKS)
|
||||||
|
|
||||||
|
dross += Books/
|
10
slides/makefiles/dependency_ladder/makes/cows
Normal file
10
slides/makefiles/dependency_ladder/makes/cows
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
cows = $(patsubst Forts/fortune_%.md,Cows/cow-%.txt,$(wildcard Forts/fortune_*.md))
|
||||||
|
|
||||||
|
$(cows): Cows/cow-%.txt: Forts/fortune_%.md
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
cat $< | cowsay > $@
|
||||||
|
|
||||||
|
progs += forts
|
||||||
|
progs += $(cows)
|
||||||
|
dross += Cows/
|
||||||
|
|
11
slides/makefiles/dependency_ladder/makes/forts
Normal file
11
slides/makefiles/dependency_ladder/makes/forts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
fnums != seq 8 | sort -R | head -2
|
||||||
|
forts = $(patsubst %,Forts/fortune_%.md,$(fnums))
|
||||||
|
|
||||||
|
$(forts):
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
fortune -s > $@
|
||||||
|
|
||||||
|
progs += $(forts)
|
||||||
|
|
||||||
|
dross += Forts/
|
14
slides/makefiles/dependency_ladder/makes/zoo
Normal file
14
slides/makefiles/dependency_ladder/makes/zoo
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
filter = $(shell cowsay -l | sort -R | head -1)
|
||||||
|
|
||||||
|
zoo = $(patsubst Forts/fortune_%.md,Zoo/animal-%.md,$(forts))
|
||||||
|
|
||||||
|
$(zoo): Zoo/animal-%.md: Forts/fortune_%.md
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
echo '```' > $@
|
||||||
|
cat $< | cowsay -f $(filter) >> $@
|
||||||
|
echo '```' >> $@
|
||||||
|
|
||||||
|
progs += forts
|
||||||
|
progs += $(zoo)
|
||||||
|
|
||||||
|
dross += Zoo/
|
Loading…
Reference in New Issue
Block a user