diff --git a/slides/makefiles/dependency_ladder/.gitignore b/slides/makefiles/dependency_ladder/.gitignore new file mode 100644 index 0000000..72e8ffc --- /dev/null +++ b/slides/makefiles/dependency_ladder/.gitignore @@ -0,0 +1 @@ +* diff --git a/slides/makefiles/dependency_ladder/makes/books b/slides/makefiles/dependency_ladder/makes/books new file mode 100644 index 0000000..7318a23 --- /dev/null +++ b/slides/makefiles/dependency_ladder/makes/books @@ -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/ diff --git a/slides/makefiles/dependency_ladder/makes/cows b/slides/makefiles/dependency_ladder/makes/cows new file mode 100644 index 0000000..fafd761 --- /dev/null +++ b/slides/makefiles/dependency_ladder/makes/cows @@ -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/ + diff --git a/slides/makefiles/dependency_ladder/makes/forts b/slides/makefiles/dependency_ladder/makes/forts new file mode 100644 index 0000000..ee61966 --- /dev/null +++ b/slides/makefiles/dependency_ladder/makes/forts @@ -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/ diff --git a/slides/makefiles/dependency_ladder/makes/zoo b/slides/makefiles/dependency_ladder/makes/zoo new file mode 100644 index 0000000..e4f78b9 --- /dev/null +++ b/slides/makefiles/dependency_ladder/makes/zoo @@ -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/