1# Makefile for sgmls on Unix.
2
3# Common prefix for installation directories.
4# This is used in the definitions of BINDIR and MANDIR.
5# It is also used by configure to choose DEFAULT_PATH.
6PREFIX=/usr/local
7# Where to install the sgmls and sgmlsasp binaries.
8BINDIR=$(PREFIX)/bin
9# Permissions mode to use for binaries
10BINMODE=755
11# Extension (without the `.') to use for the man pages.
12MANEXT=1
13# Where to install man pages.
14MANDIR=$(PREFIX)/man/man$(MANEXT)
15# Permissions mode to use for man pages.
16MANMODE=444
17
18#CC=cc
19PROFILE=
20INCLUDE=
21OPTIMIZE=-O
22DEBUG=
23WARN=
24CFLAGS=$(DEBUG) $(INCLUDE) $(WARN) $(PROFILE) $(OPTIMIZE)
25LDFLAGS=$(DEBUG) $(PROFILE)
26# Additional libraries needed.
27# Ultrix needs -li
28LIBS=
29
30# This is needed only by the format target.
31TBL=gtbl
32NROFF=groff -Tascii -P-buo
33
34# You shouldn't need to change anything after this point.
35
36PURIFY=purify
37ETAGS=etags
38SHELL=/bin/sh
39
40PROG1=sgmls
41
42SRCS1=lexrf.c pcbrf.c synrf.c context.c md1.c md2.c pars1.c pars2.c serv.c \
43      sgml1.c sgml2.c sgmlmsg.c sgmlxtrn.c traceset.c entgen.c sgmlio.c \
44      xfprintf.c main.c unixproc.c sgmldecl.c version.c strerror.c getopt.c \
45      msgcat.c lineout.c ambig.c lextaba.c catalog.c
46
47OBJS1=lexrf.o pcbrf.o synrf.o context.o md1.o md2.o pars1.o pars2.o serv.o \
48      sgml1.o sgml2.o sgmlmsg.o sgmlxtrn.o traceset.o entgen.o sgmlio.o \
49      xfprintf.o main.o unixproc.o sgmldecl.o version.o strerror.o getopt.o \
50      msgcat.o lineout.o ambig.o lextaba.o catalog.o
51
52PROG2=sgmlsasp
53
54OBJS2=sgmlsasp.o replace.o sgmls.o strerror.o getopt.o
55SRCS2a=sgmlsasp.c replace.c sgmls.c
56SRCS2=$(SRCS2a) strerror.c getopt.c
57
58PROG3=rast
59
60SRCS3a=rast.c
61SRCS3=$(SRCS3a) sgmls.c strerror.c
62OBJS3=rast.o sgmls.o strerror.o getopt.o
63
64PROG4=genlex
65SRCS4a=genlex.c ebcdic.c
66SRCS4=$(SRCS4a) lextaba.c lexrf.c
67OBJS4=genlex.o ebcdic.o lextaba.o lexrf.o
68
69SRCS=$(SRCS1) $(SRCS2a) $(SRCS3a) $(SRCS4a) lextabe.c
70
71HDRS=action.h adl.h entity.h error.h etype.h sgmldecl.h keyword.h lextoke.h \
72     msg.h sgmlaux.h sgmlfnsm.h sgmlincl.h sgmlmain.h lineout.h sgmlxtrn.h \
73     source.h synxtrn.h tools.h trace.h context.h getopt.h msgcat.h std.h \
74     appl.h sgmls.h sgmlsasp.h replace.h lexcode.h latin1.h ebcdic.h \
75     catalog.h alloc.h
76
77PROGS=$(PROG1) $(PROG2) $(PROG3)
78
79MANPAGES=sgmls.man sgmlsasp.man rast.man
80FMANPAGES=sgmls.txt sgmlsasp.txt rast.txt
81
82# Miscellaneous files to go in the distribution
83MISC=README NEWS INSTALL ChangeLog LICENSE TODO Makefile Makefile.bcc \
84     Makefile.vms Makefile.cms dos.cfg unix.cfg thinkc.cfg vms.cfg cms.cfg \
85     dosproc.c portproc.c stklen.c sgmls.pl configure
86
87# Files to go in the distribution.
88DIST=$(MISC) $(MANPAGES) $(FMANPAGES) $(SRCS) $(HDRS)
89
90.SUFFIXES: .man .txt
91
92.man.txt:
93	-rm -f $@
94	$(TBL) $< | $(NROFF) -man >$@
95
96all: $(PROGS)
97
98format: $(FMANPAGES)
99
100$(PROG1): $(OBJS1)
101	$(CC) -o $(PROG1) $(LDFLAGS) $(OBJS1) $(LIBS)
102
103$(PROG1).pure: $(OBJS1)
104	$(PURIFY) $(CC) -o $(PROG1).pure $(LDFLAGS) $(OBJS1) $(LIBS)
105
106$(PROG1).cl:
107	#setopt program_name ./$(PROG1)
108	#load -C $(SRCS1)
109
110$(PROG2): $(OBJS2)
111	$(CC) -o $(PROG2) $(LDFLAGS) $(OBJS2) $(LIBS)
112
113$(PROG2).pure: $(OBJS2)
114	$(PURIFY) $(CC) -o $(PROG2).pure $(LDFLAGS) $(OBJS2) $(LIBS)
115
116$(PROG2).cl:
117	#setopt program_name ./$(PROG2)
118	#load -C $(SRCS2)
119
120$(PROG3): $(OBJS3)
121	$(CC) -o $(PROG3) $(LDFLAGS) $(OBJS3) $(LIBS)
122
123$(PROG3).pure: $(OBJS3)
124	$(PURIFY) $(CC) -o $(PROG3).pure $(LDFLAGS) $(OBJS3) $(LIBS)
125
126$(PROG3).cl:
127	#setopt program_name ./$(PROG3)
128	#load -C $(SRCS3)
129
130$(PROG4): $(OBJS4)
131	$(CC) -o $(PROG4) $(LDFLAGS) $(OBJS4) $(LIBS)
132
133config.h: unix.cfg configure
134	@echo Generating config.h from unix.cfg.
135	@echo If this fails, copy unix.cfg to config.h and then edit config.h.
136	@echo This may take a minute or two...
137	chmod +x configure
138	CC="$(CC)" CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" PREFIX="$(PREFIX)" \
139	  ./configure
140
141lextabe.c: genlex
142	-rm -f lextabe.c
143	./genlex >$@
144
145install: $(PROGS)
146	-test -d $(DESTDIR)$(BINDIR) || mkdir $(DESTDIR)$(BINDIR)
147	for f in $(PROGS); do \
148	  cp $$f $(DESTDIR)$(BINDIR)/$$f; \
149	  chmod $(BINMODE) $(DESTDIR)$(BINDIR)/$$f; \
150	done
151
152install.man: $(MANPAGES)
153	-test -d $(DESTDIR)$(MANDIR) || mkdir $(DESTDIR)$(MANDIR)
154	for f in $(MANPAGES); do \
155	  t=$(MANDIR)/`basename $$f .man`.$(MANEXT); \
156	  cp $$f $(DESTDIR)$$t; \
157	  chmod $(MANMODE) $(DESTDIR)$$t; \
158	done
159
160clean:
161	-rm -f *.o $(PROGS) core a.out
162
163realclean: clean
164	-rm -f $(FMANPAGES)
165
166test: FORCE $(PROGS)
167	cd test; $(SHELL) RUN
168
169TAGS: $(SRCS) $(HDRS)
170	$(ETAGS) $(SRCS) $(HDRS)
171
172dist: FORCE
173	-rm -fr temp
174	mkdir temp
175	cd test; ./CLEAN
176	@version=`sed -n -e \
177           '/version_string/s/.*= "\([0-9.]*\).*/\1/p' version.c`; \
178	echo making sgmls-$$version.tar.Z; \
179	rm -f sgmls-$$version.tar.Z; \
180	mkdir temp/sgmls; \
181	ln $(DIST) temp/sgmls; \
182	cd temp/sgmls; \
183	rm Makefile; \
184	sed -e '/^CC=/s/=.*/=cc/' -e '/^PROFILE=/s/=.*/=/' \
185	  -e '/^OPTIMIZE=/s/=.*/=-O/' -e '/^DEBUG=/s/=.*/=/' \
186	  -e '/^INCLUDE=/s/=.*/=/'  -e '/^WARN=/s/=.*/=/' \
187	  -e '/^LIBS=/s/=.*/=/' ../../Makefile >Makefile; \
188	ln -s ../../test .; \
189	cd ..; \
190	tar cfh - sgmls | compress >../sgmls-$$version.tar.Z
191	-rm -fr temp
192
193dist: $(DIST)
194
195depend: FORCE
196	gcc -MM $(INCLUDE) $(SRCS) >.depend
197	cp Makefile Makefile.bak
198	sed -e '/^# Do not delete this line./{' -e 'r .depend' -e q -e '}' \
199	    Makefile.bak >Makefile
200	-rm -f .depend
201
202depend: $(SRCS)
203
204FORCE:
205
206# Do not delete this line.
207lexrf.o : lexrf.c config.h latin1.h entity.h tools.h msgcat.h catalog.h synxtrn.h \
208  action.h lexcode.h
209pcbrf.o : pcbrf.c config.h latin1.h entity.h tools.h msgcat.h catalog.h action.h \
210  synxtrn.h adl.h
211synrf.o : synrf.c config.h latin1.h entity.h tools.h msgcat.h catalog.h synxtrn.h \
212  adl.h
213context.o : context.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h \
214  catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h \
215  sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h context.h
216md1.o : md1.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h catalog.h \
217  action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h sgmlxtrn.h \
218  trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
219md2.o : md2.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h catalog.h \
220  action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h sgmlxtrn.h \
221  trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
222pars1.o : pars1.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h \
223  catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h \
224  sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
225pars2.o : pars2.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h \
226  catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h \
227  sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
228serv.o : serv.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h \
229  catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h \
230  sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
231sgml1.o : sgml1.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h \
232  catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h \
233  sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
234sgml2.o : sgml2.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h \
235  catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h \
236  sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
237sgmlmsg.o : sgmlmsg.c config.h latin1.h sgmlaux.h std.h entity.h tools.h msgcat.h \
238  catalog.h sgmldecl.h msg.h
239sgmlxtrn.o : sgmlxtrn.c sgmlincl.h config.h latin1.h std.h entity.h tools.h \
240  msgcat.h catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h \
241  synxtrn.h sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
242traceset.o : traceset.c sgmlincl.h config.h latin1.h std.h entity.h tools.h \
243  msgcat.h catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h \
244  synxtrn.h sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
245entgen.o : entgen.c config.h latin1.h sgmlaux.h std.h entity.h tools.h msgcat.h \
246  catalog.h sgmldecl.h
247sgmlio.o : sgmlio.c config.h latin1.h sgmlaux.h std.h entity.h tools.h msgcat.h \
248  catalog.h sgmldecl.h
249xfprintf.o : xfprintf.c config.h latin1.h
250main.o : main.c config.h latin1.h std.h getopt.h entity.h tools.h msgcat.h catalog.h \
251  adl.h sgmlmain.h appl.h alloc.h
252unixproc.o : unixproc.c config.h latin1.h std.h entity.h tools.h msgcat.h catalog.h \
253  appl.h
254sgmldecl.o : sgmldecl.c sgmlincl.h config.h latin1.h std.h entity.h tools.h \
255  msgcat.h catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h \
256  synxtrn.h sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
257version.o : version.c
258strerror.o : strerror.c config.h latin1.h
259getopt.o : getopt.c config.h latin1.h
260msgcat.o : msgcat.c config.h latin1.h std.h msgcat.h
261lineout.o : lineout.c config.h latin1.h std.h entity.h tools.h msgcat.h catalog.h \
262  adl.h sgmlmain.h lineout.h appl.h
263ambig.o : ambig.c sgmlincl.h config.h latin1.h std.h entity.h tools.h msgcat.h \
264  catalog.h action.h adl.h error.h etype.h keyword.h lextoke.h source.h synxtrn.h \
265  sgmlxtrn.h trace.h sgmlmain.h sgmlaux.h sgmldecl.h sgmlfnsm.h
266lextaba.o : lextaba.c config.h latin1.h entity.h tools.h msgcat.h catalog.h \
267  lexcode.h sgmldecl.h lextoke.h
268catalog.o : catalog.c config.h latin1.h std.h catalog.h alloc.h
269sgmlsasp.o : sgmlsasp.c sgmlsasp.h config.h latin1.h std.h sgmls.h replace.h \
270  getopt.h
271replace.o : replace.c sgmlsasp.h config.h latin1.h std.h replace.h
272sgmls.o : sgmls.c config.h latin1.h std.h sgmls.h lineout.h
273rast.o : rast.c config.h latin1.h std.h sgmls.h getopt.h
274genlex.o : genlex.c config.h latin1.h std.h tools.h
275ebcdic.o : ebcdic.c ebcdic.h
276lextabe.o : lextabe.c config.h latin1.h entity.h tools.h msgcat.h catalog.h \
277  sgmldecl.h
278