summaryrefslogtreecommitdiff
path: root/doc/Makefile
blob: b74756944805d2469b6994159db5d85ac2873564 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
### $Id$

include ../Make.Rules

#######################################################

FILES=pam pam_appl pam_modules
FSRCS=pam.sgml pam_appl.sgml pam_modules.sgml

TEXTS=txts/pam.txt txts/pam_appl.txt txts/pam_modules.txt
HTMLS=html/pam.html html/pam_appl.html html/pam_modules.html
PSFILES=ps/pam.ps ps/pam_appl.ps ps/pam_modules.ps
PDFFILES=pdf/pam.pdf ps/pam_appl.pdf ps/pam_modules.pdf

MODULES=$(shell ls modules/*.sgml)

#######################################################

dummy:
	@echo "Making the documentation..."
	@$(MAKE) all

# note, at this time we don't include pdf files by default, but you
# can type make pdf in this directory and see what happens in the pdf
# subdirectory.

all: htmls texts postscript pdf

htmls: $(HTMLS)

$(HTMLS) : $(FSRCS)
ifeq ($(HAVE_SGML2HTML),yes)
	@for i in $(FILES) ; do \
	if [ ! -f "html/$$i.html" ] || [ "$$i.sgml" -nt "html/$$i.html" ]; \
	then \
		cd html ; sgml2html ../$$i ; \
		if [ $$? -ne 0 ]; then exit 1 ; fi ; \
		cd .. ; \
	fi ; \
	done
else
	@echo XXX - you do not have the sgml2html binary installed
endif

texts: $(TEXTS)

$(TEXTS) : $(FSRCS)
ifeq ($(HAVE_SGML2TXT),yes)
	@for i in $(FILES) ; do \
		if [ ! -f "txts/$$i.txt" ] \
				|| [ "$$i.sgml" -nt "txts/$$i.txt" ]; then \
			cd txts ; sgml2txt ../$$i ; cd .. ; \
		fi ; \
	done
else
	@echo XXX - you do not have the sgml2txt binary installed
endif

postscript: $(PSFILES)

$(PSFILES): $(FSRCS)
ifneq ($(PSER),)
	@for i in $(FILES) ; do \
	if [ ! -f "ps/$$i.ps" ] || [ "$$i.sgml" -nt "ps/$$i.ps" ]; then \
		cd ps ; $(PSER) ../$$i ; cd .. ; \
	fi ; \
	done
else
	@echo XXX - neither sgml2ps nor sgml2latex binaries are installed
endif

pdf: $(PDFFILES)

$(PDFFILES) : $(PSFILES)
ifeq ($(HAVE_PS2PDF),yes)
	@for i in $(FILES) ; do \
	if [ ! -f "pdf/$$i.pdf" ] || [ "ps/$$i.ps" -nt "ps/$$i.pdf" ]; then \
		ps2pdf ps/$$i.ps pdf/$$i.pdf ; \
	fi ; \
	done
else
	@echo XXX - ps2pdf is not installed
endif

pam.sgml: pam_source.sgml MODULES-SGML CREDITS
	@sed -e '/^<!\-\- insert\-file MODULES\-SGML \-\->/r MODULES-SGML' pam_source.sgml | sed -e '/^<!\-\- insert\-file CREDITS \-\->/r CREDITS' > pam.sgml

MODULES-SGML: $(MODULES)
	@echo 'Building module text from files in modules/*.sgml'
	@rm -f MODULES-SGML
	@echo '<!-- modules included:' > MODULES-SGML
	@ls modules/*.sgml >> MODULES-SGML
	@echo '  and that is all -->' >> MODULES-SGML
	@cat modules/*.sgml >> MODULES-SGML

extraclean: clean

remove:
	cd man && for file in *.3 ; do \
	  rm -f $(FAKEROOT)$(MANDIR)/man3/$$file ; \
	done
	cd man && for file in *.8 ; do \
	  rm -f $(FAKEROOT)$(MANDIR)/man8/$$file ; \
	done
	cd txts && for file in *.txt; do \
	  rm -f $(FAKEROOT)$(DOCDIR)/text/$$file ; \
	done
	cd ps && for file in *.ps; do \
	  rm -f $(FAKEROOT)$(DOCDIR)/ps/$$file  ; \
	done
	cd html && for file in *.html; do \
	  rm -f $(FAKEROOT)$(DOCDIR)/html/$$file ; \
	done

install: all
ifeq ($(HAVE_SGML2TXT),yes)
	mkdir -p $(FAKEROOT)$(DOCDIR)/text
	for file in txts/*.txt; do \
	  install -m 644 $$file $(FAKEROOT)$(DOCDIR)/text ; \
	done
endif
ifneq ($(PSER),)
	mkdir -p $(FAKEROOT)$(DOCDIR)/ps
	for file in ps/*.ps; do \
	  install -m 644 $$file $(FAKEROOT)$(DOCDIR)/ps  ; \
	done
ifeq ($(HAVE_PS2PDF),yes)
	mkdir -p $(FAKEROOT)$(DOCDIR)/pdf
	for file in pdf/*.pdf; do \
	  install -m 644 $$file $(FAKEROOT)$(DOCDIR)/pdf  ; \
	done
endif
endif
ifeq ($(HAVE_SGML2HTML),yes)
	mkdir -p $(FAKEROOT)$(DOCDIR)/html
	for file in html/*.html; do \
	  install -m 644 $$file $(FAKEROOT)$(DOCDIR)/html ; \
	done
endif
	mkdir -p $(FAKEROOT)$(MANDIR)/man3
	mkdir -p $(FAKEROOT)$(MANDIR)/man8
	for file in man/*.3 ; do \
	  install -m 644 $$file $(FAKEROOT)$(MANDIR)/man3 ; \
	done
	for file in man/*.8 ; do \
	  install -m 644 $$file $(FAKEROOT)$(MANDIR)/man8 ; \
	done

spec: specs/draft-morgan-pam.raw
	cd specs/formatter && $(MAKE)
	specs/formatter/padout < specs/draft-morgan-pam.raw > specs/draft-morgan-pam-current.txt

releasedocs: all spec
	tar zvfc Linux-PAM-$(MAJOR_REL).$(MINOR_REL)-docs.tar.gz \
	--exclude CVS --exclude .cvsignore --exclude '.#*' \
	html ps txts specs/draft-morgan-pam-current.txt

clean:
	rm -f *~ *.bak
	rm -f html/pam*.html
	rm -f man/*~
	rm -f $(TEXTS)
	rm -f $(PSFILES) ps/missfont.log
	rm -f pdf/*.pdf
	rm -f MODULES-SGML pam.sgml
	rm -f specs/draft-morgan-pam-current.txt
	$(MAKE) -C specs/formatter clean