finish examples
This commit is contained in:
1
slides/makefiles/examples/.gitignore
vendored
Normal file
1
slides/makefiles/examples/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*
|
8
slides/makefiles/examples/check
Normal file
8
slides/makefiles/examples/check
Normal file
@@ -0,0 +1,8 @@
|
||||
CHECKER = command -v
|
||||
.PHONY: check
|
||||
check:
|
||||
$(CHECKER) fortune >/dev/null
|
||||
$(CHECKER) cowsay >/dev/null
|
||||
|
||||
file: | check
|
||||
fortune | cowsay > $@
|
18
slides/makefiles/examples/pats
Normal file
18
slides/makefiles/examples/pats
Normal file
@@ -0,0 +1,18 @@
|
||||
IMAGES = $(wildcard jpgs/*)
|
||||
COL = $(patsubst jpgs/%,collection/%,$(IMAGES))
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
$(info try 'show' or 'output')
|
||||
.PHONY: show
|
||||
show:
|
||||
$(info IMAGES is $(IMAGES))
|
||||
$(info Col is $(COL))
|
||||
|
||||
.PHONY: output
|
||||
output: $(COL)
|
||||
|
||||
collection/%.jpg: jpgs/%.jpg
|
||||
mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
15
slides/makefiles/examples/rules
Normal file
15
slides/makefiles/examples/rules
Normal file
@@ -0,0 +1,15 @@
|
||||
CP = ln -f
|
||||
|
||||
output: pngs/ldap.png
|
||||
|
||||
jpgs/ldap.jpg: ../../ldap/ldap.jpg
|
||||
mkdir -p $(dir $@)
|
||||
$(CP) $< $@
|
||||
|
||||
pngs/%.png: jpgs/%.jpg
|
||||
mkdir -p $(dir $@)
|
||||
$(info making $(@F) in $(@D))
|
||||
magick $< $@
|
||||
|
||||
clean:
|
||||
$(RM) -r pngs jpgs
|
10
slides/makefiles/examples/vars
Normal file
10
slides/makefiles/examples/vars
Normal file
@@ -0,0 +1,10 @@
|
||||
include /etc/os-release
|
||||
DAY != date +%d
|
||||
MESSAGE != fortune -s
|
||||
|
||||
motd_$(DAY):
|
||||
$(info Hello $(USER))
|
||||
$(info Placing message:)
|
||||
echo "Welcome to $(NAME)" > $@
|
||||
echo $(MESSAGE) >> $@
|
||||
|
Reference in New Issue
Block a user