summaryrefslogtreecommitdiff
path: root/docs/src/Makefile
blob: 5150e17054a7bd26f1d3170349c494b82d9d6c31 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
DOCS_EN := $(patsubst %.txt,%,$(wildcard *.txt */*.txt))
DOCS_ES := $(patsubst %.txt,%,$(wildcard *_es.txt */*_es.txt))
DOCS_FR := $(patsubst %.txt,%,$(wildcard *_fr.txt */*_fr.txt))
LARGE_EN := $(patsubst %.txt,%,$(wildcard *.txt))
LARGE_ES := $(patsubst %.txt,%,$(wildcard *_es.txt))
LARGE_FR := $(patsubst %.txt,%,$(wildcard *_fr.txt))
DOCS_EN := $(filter-out $(DOCS_ES), (filter-out $(DOCS_FR), $(DOCS_EN)) )
SMALL := $(filter-out $(LARGE_EN),$(DOCS_EN))
DOCS  := $(DOCS_EN) $(DOCS_ES) $(DOCS_FR)
LARGE := $(LARGE_EN) $(LARGE_ES) $(LARGE_FR)

#include $(patsubst %,%.dep,$(LARGE))

A2X = ./a2x --xsltproc-opts "--stringparam toc.section.depth 3 \
			   --stringparam toc.max.depth 2 \
			   --stringparam generate.section.toc.level 2 \
			   --stringparam generate.toc 'book toc,title chapter toc'" \
	  --asciidoc-opts "-f docbook.conf" \
	  --dblatex-opts "-P doc.publisher.show=0 -P latex.output.revhistory=0 -s ./emc2.sty"

all:
	$(MAKE) -C ../../src docs

docs htmldocs pdfdocs:
	$(MAKE) -C ../../src $@

docclean clean:
	$(MAKE) -C ../../src docclean

pdf: $(patsubst %,%.pdf,$(LARGE))
html: xref_en.links $(patsubst %,%.html,$(DOCS))
htmlclean:
	-rm -f $(patsubst %,%.html,$(DOCS))
dbclean:
	-rm -f $(patsubst %,%.dep,$(DOCS))
	-rm -f $(patsubst %,%.db,$(SMALL))
	-rm -f xref_en.links

xref_en.links: $(patsubst %,%.db,$(SMALL))
	echo $(SMALL)
	./links_db_gen.py $^ > $@

%.db: %.txt
	asciidoc -d book -o- -b docbook $< | xsltproc links.xslt - > $@ || (X=$$?; rm $@; exit $$X)

%.dep: %.txt
	./asciideps $< > $@.tmp
	mv $@.tmp $@

%.html: %.txt
	asciidoc -a linksfile=xref_en.links -a stylesheet=$(shell pwd)/linuxcnc.css -f xhtml11.conf -d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm $@; exit $$X)

#$(patsubst %,%.html,$(DOCS_ES)) :: %.html: %.txt
#	asciidoc -a stylesheet=$(shell pwd)/linuxcnc.css -f xhtml11.conf -d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm $@; exit $$X)

#$(patsubst %,%.html,$(DOCS_FR)) :: %.html: %.txt
#	asciidoc -a stylesheet=$(shell pwd)/linuxcnc.css -f xhtml11.conf -d book -a toc -a numbered -b xhtml11 $< || (X=$$?; rm $@; exit $$X)

%.pdf: %.txt
	$(A2X) -L -d book -vf pdf $< || (X=$$?; rm $@; exit $$X)

$(patsubst %,%.html,$(LARGE)) :: %.html: %.txt
	$(A2X) --stylesheet=./linuxcnc.css -L -d book -vf xhtml $< || (X=$$?; rm $@; exit $$X)

#$(patsubst %,%.html,$(LARGE_ES)) :: %.html: %.txt
#	$(A2X) --stylesheet=../linuxcnc.css -L -d book -vf xhtml $< || (X=$$?; rm $@; exit $$X)

#$(patsubst %,%.html,$(LARGE_FR)) :: %.html: %.txt
#	$(A2X) --stylesheet=../linuxcnc.css -L -d book -vf xhtml $< || (X=$$?; rm $@; exit $$X)

.PHONY: all docs htmldocs pdfdocs docclean clean