I := include B := build MACROS := $(I)/m4/aple.m4 M4_ARGS := $(MACROS) ifeq ($(findstring pub, $(MAKECMDGOALS)),) m4 := $(wildcard *.m4) M4_ARGS += -D PUBLIC=false DEST := $(B)/internal else m4 := Introduction.m4 Unix_Concepts.m4 Networking.m4 LVM.m4 \ Filesystems.m4 OS-Level_Virtualization.m4 M4_ARGS += -D PUBLIC=true DEST := $(B)/public endif CSS := aple.css html := $(m4:.m4=.html) imgs := $(wildcard $(I)/imgs/*.svg) files := $(html) $(CSS) index.html $(notdir $(imgs)) aple.ico all: $(addprefix $(DEST)/, $(files)) pub: all LN_CMD = ln -f $< $@ $(DEST): mkdir -p $@ # m4 -> html MD_CMD = m4 $(M4_ARGS) $< | sed -e '1,/^/d' \ | markdown -f tables,links > $@ $(DEST)/Bash.html: Bash.m4 $(MACROS) | $(DEST) $(MD_CMD) $(DEST)/Command_Line_Utilities.html: Command_Line_Utilities.m4 $(MACROS) | $(DEST) $(MD_CMD) $(DEST)/Git.html: Git.m4 $(MACROS) | $(DEST) $(MD_CMD) $(DEST)/Gridengine.html: Gridengine.m4 $(MACROS) | $(DEST) $(MD_CMD) $(DEST)/%.html: %.m4 $(MACROS) | $(DEST) m4 $(M4_ARGS) $< > $@ # svg $(DEST)/%.svg: $(I)/imgs/%.svg | $(DEST) $(LN_CMD) $(DEST)/%.ico: $(I)/imgs/%.svg | $(DEST) convert -level 0%,100%,0.1 $< $@ # style sheet $(DEST)/$(CSS): $(I)/css/$(CSS) | $(DEST) $(LN_CMD) # index.html $(DEST)/index.html: $(DEST)/Introduction.html $(LN_CMD) .PHONY: clean clean: rm -rf $(B) -include Makefile.local