dependency ladder example

This commit is contained in:
Malin Freeborn 2024-11-25 14:28:59 +01:00
parent 4c51ade750
commit f358103f79
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
5 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1 @@
*

View 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/

View 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/

View 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/

View 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/