aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/Makefile.pamphlet
blob: f48ef5b556366a84a17074d2fb3fe047145c0cc4 (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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
%% Oh Emacs, this is a -*- Makefile -*-, so give me tabs.
\documentclass{article}
\usepackage{axiom}

\title{\$SPAD/src/hyper Makefile}
\author{Timothy Daly \and Gabriel Dos~Reis}

\begin{document}

\maketitle

\begin{abstract}
\end{abstract}

\tableofcontents
\eject

NOTE:

The programs \Tool{hypertex}, \Tool{htadd}, and \Tool{htsearch}, used
to be installed in [[$(axiom_target_bindir)]].  Now all executable
from HyperDoc component are installed in [[$(axiom_target_libdir)]].

\section{Environment variables}

The programs \Tool{hypertex} and \Tool{spadbuf} require either
X11 support or socket support, or both.
<<environment>>=
bin_PROGRAMS = htadd$(EXEEXT) hthits$(EXEEXT) ex2ht$(EXEEXT)
ifeq ($(strip $(axiom_use_x)),yes)
bin_PROGRAMS += hypertex$(EXEEXT) spadbuf$(EXEEXT)
endif

# this is where to put the various commands
OUTLIB=	$(axiom_target_libdir)

# this is where the include files live
INC=    $(axiom_src_srcdir)/include

# this is where the hypertex documentation files are
HYPER=$(axiom_target_datadir)/hypertex

HTADD=$(OUTLIB)/htadd

BITMAPS = mouse11.bitmap mouse11.mask sdown3d.bitmap sdown3dpr.bitmap \
	sdown.bitmap sup3d.bitmap sup3dpr.bitmap sup.bitmap ht_icon

SCRIPTS=${OUTLIB}/htsearch ${OUTLIB}/presea

BINFILES= $(addprefix $(OUTLIB)/,$(bin_PROGRAMS))

HEADERS = addfile.h cond.h dialog.h display.h event.h extent.h \
	group.h hterror.h hyper.h initx.h keyin.h lex.h mem.h \
	parse.h parse-aux.h parse-paste.h parse-types.h scrollbar.h \
	show-types.h titlebar.h token.h $(axiom_c_macros_h)


build_libdir = $(abs_top_builddir)/src/lib

hypertex_sources = addfile.c cond.c dialog.c display.c event.c extent1.c \
		extent2.c form-ext.c group.c halloc.c hash.c hterror.c \
		htinp.c hyper.c initx.c input.c item.c keyin.c lex.c \
		macro.c mem.c parse.c parse-aux.c parse-input.c \
		parse-paste.c parse-types.c ReadBitmap.c scrollbar.c \
		show-types.c spadint.c titlebar.c

libspad_la = $(axiom_target_libdir)/libspad.la

hypertex_SOURCES = $(hypertex_sources:.c=.pamphlet)
hypertex_objects = $(hypertex_sources:.c=.lo)
hypertex_LDADD = $(libspad_la)
hypertex_DEPENDENCIES =

htadd_sources = addfile.c halloc.c hash.c htadd.c hterror.c lex.c
htadd_SOURCES = $(htadd_sources:.c=.pamphlet)
htadd_objects = $(htadd_sources:.c=.lo)
htadd_LDADD = $(libspad_la)
htadd_DEPENDENCIES =

htsearch_SOURCES = search.pamphlet

spadbuf_sources = spadbuf.c
spadbuf_SOURCES = $(spadbuf_sources:.c=.pamphlet)
spadbuf_objects = $(spadbuf_sources:.c=.lo)
spadbuf_LDADD = $(libspad_la)
spadbuf_DEPENDENCIES =

hthits_sources = hthits.c
hthits_SOURCES = $(hthits_sources:.c=.pamphlet)
hthits_objects = $(hthits_sources:.c=.lo)
hthits_LDADD = $(libspad_la)
hthits_DEPENDENCIES =

ex2ht_sources = ex2ht.c
ex2ht_SOURCES = $(ex2ht_sources:.c=.pamphlet)
ex2ht_objects = $(ex2ht_sources:.c=.lo)
ex2ht_LDADD = $(libspad_la)
ex2ht_DEPENDENCIES =

pamphlets = Makefile.pamphlet $(hypertex_SOURCES) $(htadd_SOURCES) \
		$(htsearch_SOURCES) $(spadbuf_SOURCES) $(hthits_SOURCES) \
		$(ex2ht_SOURCES)
@

\section{header files}

We use a very simple and general rule to extract C source code and header
files.  The names of the corresponding files are conveniently named after
the pamphlet files.
<<header files>>=
.PRECIOUS: %.h

$(HEADERS): %.h: $(srcdir)/%.pamphlet
	$(axiom_build_document) --tangle=$*.h --output=$@ $<
@

For that naming scheme to work correctly with noweb --- the tool 
currently used by Axiom, to support its notion implementation of literate
programming --- it must be
ensured that the filenames contain only characters that can be rendered
properly by \LaTeX{} in non-math mode.  There are various ways to
ensure that, ranging from restricted character set to escaping active
characters.  We have retained the restricted character set solution.

<<objects>>=
.PRECIOUS: %.lo %.$(OBJEXT)
.PRECIOUS: %.c

%.lo: %.c $(HEADERS)
	$(COMPILE) -o $@ $(CFLAGS) ${CCF} $(axiom_includes) $(AXIOM_X11_CFLAGS) -I. $<

%.c: $(srcdir)/%.pamphlet
	$(axiom_build_document) --tangle --output=$@ $<

@


\section{bitmaps}
There are two files for each (special) character glyph, one
for the upper case form, and one for the lower case form.
For more information about hese bitmaps see 'util.ht' in the
section 'pages', below.

<<bitmaps>>=
mouse11.bitmap: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=mouse11.bitmap --output=$@ $< 

mouse11.mask: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=mouse11.mask --output=$@ $< 

sdown3d.bitmap: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=sdown3d.bitmap --output=$@ $< 

sdown3dpr.bitmap: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=sdown3dpr.bitmap --output=$@ $< 

sdown.bitmap: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=sdown.bitmap --output=$@ $< 

sup3d.bitmap: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=sup3d.bitmap --output=$@ $< 

sup3dpr.bitmap: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=sup3dpr.bitmap --output=$@ $< 

sup.bitmap: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=sup.bitmap --output=$@ $< 

ht_icon: $(srcdir)/bitmaps.pamphlet
	$(axiom_build_document) --tangle=hticon --output=$@ $< 
@

\section{search}
<<search>>=
${OUTLIB}/htsearch: $(srcdir)/search.pamphlet
	$(axiom_build_document) --tangle=htsearch --output=$@ $<
	chmod a+x ${OUTLIB}/htsearch

${OUTLIB}/presea: $(srcdir)/search.pamphlet
	$(axiom_build_document) --tangle=presea --output=$@ $<
	chmod a+x ${OUTLIB}/presea
@

\section{ex2ht binary}
<<ex2ht (BIN)>>=
${OUTLIB}/ex2ht$(EXEEXT): $(ex2ht_objects) $(ex2ht_DEPENDENCIES)
	${LINK} -o $@ $(ex2ht_objects) $(ex2ht_LDADD) $(AXIOM_X11_LDFLAGS) -lm
@

\section{htadd binary}
<<htadd (BIN)>>=
$(OUTLIB)/htadd$(EXEEXT): $(htadd_objects) $(htadd_DEPENDENCIES)
	${LINK} -o $@ $(htadd_objects) $(htadd_LDADD) $(AXIOM_X11_LDFLAGS) -lm
@

\section{hthits binary}
<<hthits (BIN)>>=
${OUTLIB}/hthits$(EXEEXT): $(hthits_objects) $(hthits_DEPENDENCIES)
	${LINK} -o $@ $(hthits_objects) $(hthits_LDADD) $(AXIOM_X11_LDFLAGS) -lm

@

\section{hypertex binary}
<<hypertex (BIN)>>=
$(OUTLIB)/hypertex$(EXEEXT): $(hypertex_objects) $(hypertex_DEPENDENCIES)
	 ${LINK} -o $@ $(hypertex_objects) $(hypertex_LDADD) \
		$(AXIOM_X11_LDFLAGS) -lm
@

\section{spadbuf binary}
<<spadbuf (BIN)>>=
${OUTLIB}/spadbuf$(EXEEXT): $(spadbuf_objects) $(spadbuf_DEPENDENCIES)
	${LINK} -o $@ $(spadbuf_objects) $(spadbuf_LDADD) \
		$(AXIOM_X11_LDFLAGS) -lm
@

\section{pages}
The 'ht.db' is built when pages from 'src/hyper/pages' such as 'util.ht'
and 'util.pht' are installed in the target directory. Because the .db
file must be kept in sync with the page filesof course care must be
taken not to overwrite these files at a later time without re-building
the database.

The Axiom system from which this branch had been made appears 
to contain a redundant copy of util.ht. Removing the version of
'util.ht' in 'src/share/doc/hypertex/pages/util.ht' would make
Makefile logic simpler so it has been removed to minimize problems
when this file is updated.

The [[.pht]] files contain hardcoded pathnames to viewport directories
in the installed system.  Of course, that is asking for trouble.  During
installation, we must change those paths to reflect the correct
location of the viewports.  That necessary step is implemented
as:
\begin{verbatim}
             for A in `ls *.pht`; do \
                sed 's,/doc/viewports/,/share/viewports/,g' $$A \
                                        > ${HYPER}/pages/$$A; \
             done
\end{verbatim}

In the long term, the [[.pht]] and viewports should be generated at either
build time or installation time using commands like:
\begin{verbatim}
             rm -f ht.db
             ${HTADD} *.ht
             for A in `ls *.ht`; do ${SMAN} -paste $$a ; done
             rm -f ht.db
             ${HTADD} *.ht *.pht
\end{verbatim}

On case-insensitive filesytems such as Windows and traditional Mac
checkout from the source archive can fail if files have names
differing only in case: poly.ht contra POLY.ht and
poly.pht contra POLY.pht. To avoid conflicts on case-insensitive
filesytems we renamed [[poly.ht]] to [[polys.ht]] and [[poly.pht]]
to [[polys.pht]].

The page [[util.ht]] refers to two files for each (special) character
glyph, one for the upper case form, and one for the lower case form.
The names for these files avoid the use of upper and lower letters
to distinguish these forms. Intstead we use 'xxx.bitmap' for lower case
and 'xxx-cap.bitmap' for upper case, where "xxx" is the common name for
the glyth. For example alpha.bitmap and alpha-cap.bitmape.

We need to make sure that [[ht.db]], the hypertex database file
is up to date. The file contains absolute offsets into the various
[[ht]] and [[pht]] files so it must reflect the current pages. In
order to do this we run [[htadd]] in the [[${HYPER}/pages]] directory.
<<pages>>=
${HYPER}/pages/ht.db: $(HTADD) $(srcdir)/pages/*.ht $(srcdir)/pages/*.pht
	@echo making ${HYPER}/pages from $(axiom_src_srcdir)/pages directory
	@ mkdir -p ${HYPER}/pages
	@ cp -pr $(srcdir)/pages/*.ht ${HYPER}/pages
	@ for A in `ls $(srcdir)/pages/*.pht`; do \
	     sed 's,/doc/viewports/,/share/viewports/,g' $$A \
			> ${HYPER}/pages/`basename $$A`; \
	     done
	@ rm -f ${HYPER}/pages/ht.db ; \
          rm -f ${HYPER}/pages/*~ ; AXIOM=$(AXIOM) \
	  ${HTADD} -s ${HYPER}/pages/*.ht ${HYPER}/pages/*.pht
	@ cp -pr $(srcdir)/bitmaps ${HYPER}
	@ cp -pr $(srcdir)/viewports $(axiom_target_datadir)

@

<<*>>=
<<environment>>

subdir = src/hyper/

.PHONY: all all-hyper
.SUFFIXES:
.SUFFIXES: .c .o .h

all: all-ax

all-ax all-hyper: stamp
	@ echo finished $(builddir)

stamp: $(HEADERS) ${BITMAPS} ${SCRIPTS} ${BINFILES} ${HYPER}/pages/ht.db  
	-rm -f stamp
	$(STAMP) stamp

mostclean-local:

clean-local: mostclean-local
	-rm -f $(objects)
	-rm -f $(hypertex_sources)
	-rm -f $(htadd_sources)
	-rm -f $(htsearch_sources)
	-rm -f $(spadbuf_sources)
	-rm -f $(hthits_sources)
	-rm -f $(ex2ht_sources)
	-rm -f $(BINFILES)

distclean-local: clean-local

<<header files>>

<<objects>>

<<bitmaps>>

<<pages>>

<<search>>

<<ex2ht (BIN)>>

<<htadd (BIN)>>

<<hthits (BIN)>>

<<hypertex (BIN)>>

<<spadbuf (BIN)>>
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}