-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
144 lines (116 loc) · 3.83 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
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
VERSION=5.2.0
TARGETS=ic_ecommerce ic_howto_cvs ic_howto_forum ic_howto_qb icadvanced iccattut icconfig iccontent icdatabase icfaq icfoundation ic_i18n icprogrammer ictable_editor ictags ictemplates icupgrade icvariables
SUFFIXES=txt html pdf pod 8
MAXSUFFIXES=mif
SDFBIN=sdf/bin/sdf
FRAMESDIR=frames
FRAMESPARENT=..
DEVDIR=dev
DOCDBNAME=documentation.txt
PKGNAME=interchange-doc-$(VERSION)
INSTALLDIR=/var/www/html/doc
IMAGES=bullet.gif pdf.gif pod.gif iclogo.gif text.gif
.SUFFIXES: .sdf .frames $(addprefix .,$(SUFFIXES))
.sdf.html:
$(SDFBIN) -2html -DFULL_TARGETS="$(TARGETS)" -DFRAMES_DIR=$(FRAMESDIR)/ $<
.sdf.frames:
@make $(basename $<)_frames.html $(basename $<)_toc.html
.sdf.pod:
$(SDFBIN) -2pod -DFULL_TARGETS="$(TARGETS)" $<
@perl -ni -e 'if ($$f > 2 or ! /^=head1/) { print; next; } ++$$f; unless ($$f == 2) { print; next; } print qq{=head1 DESCRIPTION\n\n$$_};' $@
.sdf.txt:
$(SDFBIN) -2txt -DFULL_TARGETS="$(TARGETS)" $<
.sdf.mif:
$(SDFBIN) -2mif -DFULL_TARGETS="$(TARGETS)" $<
.sdf.pdf:
$(SDFBIN) -2pdf_html -DFULL_TARGETS="$(TARGETS)" $<
.pod.8:
pod2man --section=8 --release='Interchange $(VERSION)' --center='Interchange' --lax $< > $@ || true
all :: $(SUFFIXES) frames_html icfull
max :: all $(EXTRASUFFIXES)
install :: all
@mkdir -p $(INSTALLDIR)
@for i in $(TARGETS) icfull ; do \
for j in $(SUFFIXES) ; do \
cp -aiv $$i.$$j $(INSTALLDIR) ; \
done ; \
done
@cp -aiv $(FRAMESDIR) $(INSTALLDIR)
docdb :: pod
perl scripts/makedocdb.pl
tardist :: all
@echo Packing documentation files into $(PKGNAME).tar.gz
@rm -rf $(PKGNAME).tar.gz $(PKGNAME)
@mkdir -p $(PKGNAME)
@( for i in $(TARGETS) icfull ; do \
for j in $(SUFFIXES) ; do \
echo $$i.$$j ; \
done ; \
done ; \
echo index.html $(FRAMESDIR) interchange-doc.spec $(IMAGES) ) | \
xargs tar cf - | (cd $(PKGNAME) && tar xf -)
@tar cf $(PKGNAME).tar $(PKGNAME)
@rm -rf $(PKGNAME)
@gzip -9f $(PKGNAME).tar
dev_html:
@mkdir -p $(DEVDIR)
@for target in $(addsuffix .sdf,$(TARGETS)) ; do \
base=`basename $$target .sdf`; \
echo Building $$base; \
( echo '1s/OPT_LOOK="akopia"/OPT_LOOK="developer_site"/' ; echo 'wq $(DEVDIR)/'$$target ) | ed $$target > /dev/null 2>&1 ; \
$(SDFBIN) -2html_topics -DITL_ESCAPE -n2 -k=developer_site -O$(DEVDIR) $$target ; \
done
@echo Building index
@( echo '1s/akopia/developer_site/' ; echo 'wq dev_index.sdf' ) | ed index.sdf > /dev/null 2>&1
@make dev_index.html
@rm dev_index.sdf
@mv dev_index.html $(DEVDIR)/index.html
%_toc.html: %.sdf
@echo Making $(FRAMESDIR)/$@
@mkdir -p $(FRAMESDIR)
@( cd $(FRAMESDIR) ; ln -sf ../bullet.gif )
@$(SDFBIN) -2html_topics -n2 -DFULL_TARGETS="$(TARGETS)" -DHTML_FRAMES=1 -DFRAMES_DIR=$(FRAMESDIR)/ -DSDF_ROOT=$(FRAMESPARENT)/ -O$(FRAMESDIR) $<
@( cd $(FRAMESDIR) ; mv $(basename $<).html $@ )
%_frames.html: %.sdf
@echo Making $(FRAMESDIR)/$@
@mkdir -p $(FRAMESDIR)
@echo '\
<html><head>\
<title>'$$title'</title>\
</head><frameset cols="200,*">\
<frame name="nav" src="$(basename $<)_toc.html">\
<frame name="main" src="$(basename $<)_1.html">\
</frameset></html>\
' > $(FRAMESDIR)/$@
frames_html:: $(addsuffix _frames.html,$(TARGETS))
frames_html:: $(addsuffix _toc.html,$(TARGETS))
frames_html html:: index.html
frames:: frames_html
html:: $(addsuffix .html,$(TARGETS))
pod: $(addsuffix .pod,$(TARGETS))
txt: $(addsuffix .txt,$(TARGETS))
mif: $(addsuffix .mif,$(TARGETS))
8: $(addsuffix .8,$(TARGETS))
man: 8
pdf: $(addsuffix .pdf,$(TARGETS))
icfull: $(addprefix icfull.,$(SUFFIXES))
$(TARGETS):
@for i in $(SUFFIXES) frames ; do \
$(MAKE) $@.$$i ; \
done
clean:
@for i in $(TARGETS) icfull ; do \
for j in $(SUFFIXES) $(MAXSUFFIXES) ; do \
rm -f $$i.$$j ; \
done ; \
rm -f $${i}_*.html ; \
done
@rm -f index.html
@rm -f $(DOCDBNAME)
@rm -rf icdocdb
@rm -f *~
@rm -f $(PKGNAME).tar
@rm -f $(PKGNAME).tar.gz
@rm -rf $(PKGNAME)
@rm -rf $(DEVDIR)
@rm -rf $(FRAMESDIR)