Commit ee0fab1e authored by Alija Sabic's avatar Alija Sabic
Browse files

Cleanup and templatize Makefile

parent 1ab04102
# -*- cperl -*- # -*- cperl -*-
# latexmkrc # latexmkrc
$builddir = $ENV{'BUILDDIR'}; $builddir = $ENV{'BUILDDIR'};
$target = $ENV{'TARGET'};
$bibdirs = $ENV{'BIBDIRS'}; $bibdirs = $ENV{'BIBDIRS'};
$target = $ENV{'TARGET'};
$type = $ENV{'TYPE'}; $type = $ENV{'TYPE'};
$viewer = $ENV{'VIEWER'}; $viewer = $ENV{'VIEWER'};
......
BASENAME = demo BASENAME = demo
BUILDDIR = build BUILDDIR = build
VARIANTS = presentation handout notes
TARGETS = $(BASENAME)-presentation.pdf \ TARGETS = $(BASENAME)-presentation.pdf \
$(BASENAME)-handout.pdf \ $(BASENAME)-handout.pdf \
$(BASENAME)-notes.pdf $(BASENAME)-notes.pdf
...@@ -24,38 +25,20 @@ clean: ...@@ -24,38 +25,20 @@ clean:
distclean: distclean:
rm -rf $(BUILDDIR) rm -rf $(BUILDDIR)
$(BASENAME)-presentation.pdf presentation presentation.build: setup define TEMPLATE =
$(call LATEXMKV,presentation,) $(BASENAME)-$(strip $(1)).pdf $(strip $(1)).build $(1): setup
presentation.view: setup $(call LATEXMKV,$(strip $(1)),)
$(call LATEXMKV,presentation,-pv) $(strip $(1)).view: setup
presentation.preview: setup $(call LATEXMKV,$(strip $(1)),-pv)
$(call LATEXMKV,presentation,-pvc) $(strip $(1)).preview: setup
presentation.clean: setup $(call LATEXMKV,$(strip $(1)),-pvc)
$(call LATEXMKV,presentation,-c) $(strip $(1)).clean: setup
presentation.distclean: setup $(call LATEXMKV,$(strip $(1)),-c)
$(call LATEXMKV,presentation,-C) $(strip $(1)).distclean: setup
$(call LATEXMKV,$(strip $(1)),-C)
endef
$(BASENAME)-handout.pdf handout handout.build: setup $(foreach variant, $(VARIANTS), $(eval $(call TEMPLATE, $(variant))))
$(call LATEXMKV,handout,)
handout.view: setup
$(call LATEXMKV,handout,-pv)
handout.preview: setup
$(call LATEXMKV,handout,-pvc)
handout.clean: setup
$(call LATEXMKV,handout,-c)
handout.distclean: setup
$(call LATEXMKV,handout,-C)
$(BASENAME)-notes.pdf notes notes.build: setup
$(call LATEXMKV,notes,)
notes.view: setup
$(call LATEXMKV,notes,-pv)
notes.preview: setup
$(call LATEXMKV,notes,-pvc)
notes.clean: setup
$(call LATEXMKV,notes,-c)
notes.distclean: setup
$(call LATEXMKV,notes,-C)
# dynamic targets # dynamic targets
%.build: setup %.build: setup
...@@ -73,7 +56,7 @@ notes.distclean: setup ...@@ -73,7 +56,7 @@ notes.distclean: setup
setup: .FORCE | $(BUILDDIR)/ setup: .FORCE | $(BUILDDIR)/
.PHONY: all presentation handout notes view preview clean distclean .FORCE .PHONY: all presentation handout notes clean distclean .FORCE
.EXPORT_ALL_VARIABLES: .EXPORT_ALL_VARIABLES:
TEXINPUTS := :.:$(TEXDIRS) TEXINPUTS := :.:$(TEXDIRS)
......
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment