From 5fad3e11c55ae75a114da38a35f23c61f81db927 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 28 Oct 2023 15:06:09 +0200 Subject: Refactor Makefile --- Makefile | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 079681f..6acdb36 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,22 @@ .PHONY: check clean serve -gendeps = ${filter-out %/index.gsp,${wildcard ${1}/*}} -includes := ${wildcard include/*} -srcdirs := ${shell find src -type d} -outdirs := ${srcdirs:src%=out%} -sources := ${shell find src -type f -regextype egrep -regex '.*/(index\.gsp|.*\.(css|svg|png|dot))'} -outputs := ${sources:src/%=out/%} -outputs := ${outputs:%.gsp=%.html} -outputs := ${outputs:%.dot=%.svg} - -all: ${outdirs} ${outputs} fonts +gendeps = $(filter-out %/index.gsp,$(wildcard $1/*)) +fonts := $(wildcard fonts/*) +includes := $(wildcard include/*) +srcdirs := $(shell find src -type d) +outdirs := $(srcdirs:src%=out%) +sources := $(shell find src -type f -regextype egrep -regex '.*/(index\.gsp|.*\.(css|svg|png|dot))') +outputs := $(sources:src/%=out/%) +outputs := $(outputs:%.gsp=%.html) +outputs := $(outputs:%.dot=%.svg) + +all: $(outdirs) out/fonts $(outputs) + +out/fonts: $(fonts) @cp -r fonts out @printf 'CP\tfonts\n' -${outdirs}: +$(outdirs): @mkdir -p $@ @printf 'MKDIR\t%s\n' "$@" @@ -25,20 +28,20 @@ out/%.svg: src/%.dot @dot -Tsvg $< >$@ @printf 'DOT\t%s\n' "$@" -out/%.html: src/%.gsp ${includes} src/style.css +out/%.html: src/%.gsp $(includes) src/style.css @PATH="$$PATH:./include" \ - m4 -P ${foreach dir,${^D},-I${dir}} include/lib.m4 $< | gsp >$@ + m4 -P $(foreach dir,$(^D),-I$(dir)) include/lib.m4 $< | gsp >$@ @printf 'GSP\t%s\n' "$@" -src/srp/fw-ec/index.gsp: ${call gendeps,src/srp/fw-ec} +src/srp/fw-ec/index.gsp: $(call gendeps,src/srp/fw-ec) @touch $@ -src/srp/gsp/index.gsp: ${call gendeps,src/srp/gsp} +src/srp/gsp/index.gsp: $(call gendeps,src/srp/gsp) @touch $@ -src/prj/mmv/index.gsp: ${call gendeps,src/prj/mmv} +src/prj/mmv/index.gsp: $(call gendeps,src/prj/mmv) @touch $@ -src/prj/mkpass/index.gsp: ${call gendeps,src/prj/mkpass} +src/prj/mkpass/index.gsp: $(call gendeps,src/prj/mkpass) @touch $@ -src/prj/totp/index.gsp: ${call gendeps,src/prj/totp} +src/prj/totp/index.gsp: $(call gendeps,src/prj/totp) @touch $@ check: -- cgit v1.2.3