File: Makefile

package info (click to toggle)
gprbuild 2011-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 10,396 kB
  • sloc: ada: 94,726; sh: 2,818; xml: 2,225; makefile: 471; ansic: 240; cpp: 89; fortran: 62; asm: 27
file content (69 lines) | stat: -rw-r--r-- 2,085 bytes parent folder | download
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
## The documentation packages are built in subdirectories, to match
## what is done in AdaCore's automatic packaging

DOC=gprbuild_ug
MAKEINFO_HTML_FLAGS=--html --number-sections --css-include=gprbuild.css --no-headers --no-split

MAKE_INFO=makeinfo --force --no-split
MAKE_TXT=$(MAKE_INFO) --no-headers --fill-column=79
MAKE_PDF=texi2pdf -q
MKDIR=mkdir -p
RMDIR=rmdir
CP=cp
EXE=

.PHONY: all txt info html pdf clean

all: txt info html pdf

# The following are written to make sure the build fails if the output file
# already exists, and cannot be overwritten. For example, if we have
# pdf/gprbuild_ug.pdf open in a browser on windows, the $(MAKE_PDF) command
# will complain:
#    cp: cannot create regular file `.../gprbuild_ug.pdf': Device or resource busy
# but still returns a zero (successful) exit status. Therefore, we delete the
# output first, so the ${RMDIR} will correctly return a non-zero status.
# But if pdf does not exist, then the ${RMDIR} command will incorrectly fail;
# therefore, we do ${MKDIR} first -- hence we do ${MKDIR} twice, which is a bit
# odd, but successfully works around the bug in $(MAKE_PDF) (i.e. texi2pdf).

txt: prepare
	${MKDIR} txt
	${RM} txt/*
	${RMDIR} txt
	${MKDIR} txt
	$(MAKE_TXT) -o txt/$(DOC).txt $(DOC).texi
info: prepare
	${MKDIR} info
	${RM} info/*
	${RMDIR} info
	${MKDIR} info
	$(MAKE_INFO) -o info/$(DOC).info $(DOC).texi
html: prepare
	${MKDIR} html
	${RM} html/*
	${RMDIR} html
	${MKDIR} html
	$(MAKE_INFO) ${MAKEINFO_HTML_FLAGS} -o html/$(DOC).html $(DOC).texi
	$(CP) important.png note.png tip.png html/
pdf: prepare
	${MKDIR} pdf
	${RM} pdf/*
	${RMDIR} pdf
	${MKDIR} pdf
	cd pdf; $(MAKE_PDF) -c ../$(DOC).texi

prepare:
	gnatmake ../gnat/xgnatugn
	xgnatugn${EXE} unw ../gnat/projects.texi ../gnat/ug_words projects_unw.texi

partial_clean:
	${RM} ${DOC}.aux ${DOC}.cp ${DOC}.cps ${DOC}.cps ${DOC}.fn
	${RM} ${DOC}.ky ${DOC}.log ${DOC}.pg ${DOC}.toc ${DOC}.tp
	${RM} ${DOC}.vr
	${RM} xgnatugn* projects_unw.texi

clean: partial_clean
	${MKDIR} txt html info pdf
	${RM} txt/* html/* info/* pdf/*
	${RMDIR} txt html info pdf