testディレクトリーをsampleに変更
[makefiles.git] / latex_mk / sample / bibtex / Makefile
1 .PHONY: all bib-update bib-rebase body-update body-rebase rebase clean distclean
2
3 CAT := cat
4 CMP := cmp -s
5 DIFF := diff
6 PATCH := patch
7 SED := sed
8
9 TEXTARGETS := bibtex.pdf
10
11 $(TEXTARGETS):
12
13 all:
14         @$(MAKE) -s bibtex_1.pdf
15         @$(ECHO)
16         @$(MAKE) -s bibtex_2.pdf
17
18 bibtex_1.pdf: rebase
19         @$(ECHO) '---------- $@: $^ ----------'
20         @$(MAKE) -s bibtex.pdf
21         @$(CP) -v bibtex.pdf $@
22
23 bibtex_2.pdf: update
24         @$(ECHO) '---------- $@: $^ ----------'
25         @$(MAKE) -s bibtex.pdf
26         @$(CP) -v bibtex.pdf $@
27
28 include latex.mk
29
30 update: body-update bib-update
31
32 rebase: body-rebase bib-rebase
33
34 bib-update: bib-rebase
35         $(CAT) ref_add.bib >>ref.bib
36
37 bib-rebase:
38         $(CMP) ref.bib.base ref.bib || $(CP) -v ref.bib.base ref.bib
39
40 body-update: bibtex.tex.2nd.patch
41         @$(PATCH) <$<
42
43 bibtex.tex.2nd.patch: rebase
44         @$(DIFF) -u bibtex.tex bibtex.tex.2nd >$@ || exit 0
45
46 body-rebase:
47         $(CMP) bibtex.tex.base bibtex.tex || $(CP) -v bibtex.tex.base bibtex.tex
48
49 clean: tex-clean
50
51 distclean: rebase clean tex-distclean
52         $(RM) *.patch
53         $(RM) bibtex_*.pdf