-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
53 lines (43 loc) · 1.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
NAME := gnome-desktop-programming
PDFLATEX := $(shell which pdflatex)
BUILDDIR := build
PDFTARGET := $(BUILDDIR)/$(NAME).pdf
all: $(PDFTARGET)
TEX_FILES :=
TEX_FILES += book/chapter1.tex
TEX_FILES += book/commands.tex
TEX_FILES += book/gnome-desktop-programming.tex
TEX_FILES += book/introduction.tex
TEX_FILES += book/preface.tex
FIGURE_FILES :=
EXERCISE_FILES :=
$(BUILDDIR)/%.tex: figures/%.c
@mkdir -p $(BUILDDIR)
@echo " [FORMAT] $*"
@./scripts/formatter.py figures/$*.c $(BUILDDIR)/$*.tex
$(BUILDDIR)/exercise%.tex: exercises/exercise%.c
@mkdir -p $(BUILDDIR)
@echo " [FORMAT] exercise$*"
@./scripts/formatter.py exercises/exercise$*.c $(BUILDDIR)/exercise$*.tex
TEX_DEPS :=
TEX_DEPS += $(TEX_FILES)
TEX_DEPS += $(foreach var,$(FIGURE_FILES),$(BUILDDIR)/$(var:.c=.tex))
TEX_DEPS += $(foreach var,$(EXERCISE_FILES),$(BUILDDIR)/$(var:.c=.tex))
$(PDFTARGET): $(TEX_DEPS)
@mkdir -p $(BUILDDIR)
@echo " [COPY] styles"
@cp -a styles/*.sty $(BUILDDIR)
@echo " [COPY] tex"
@cp -a book/*.tex $(BUILDDIR)
@echo " [COPY] out"
@cp -a exercises/*.out $(BUILDDIR)
@echo " [TOC] $(NAME)"
@TEXINPUTS=:$(BUILDDIR) $(PDFLATEX) -halt-on-error -output-directory $(BUILDDIR) -output-format pdf $(NAME).tex >/dev/null
@echo " [PDFLATEX] $(NAME).pdf"
@rm $(BUILDDIR)/$(NAME).pdf
@TEXINPUTS=:$(BUILDDIR) $(PDFLATEX) -halt-on-error -output-directory $(BUILDDIR) -output-format pdf $(NAME).tex >/dev/null
view: $(PDFTARGET)
evince $(PDFTARGET)
clean:
@echo " [CLEAN] build"
@rm -rf $(BUILDDIR)