1#
2#########################################################################
3#
4# makefile for The Hessling Editor (THE)
5# Innotek GCC OS/2
6#
7# You need the following environment variable set like:
8# THE_SRCDIR=c:\the
9# PDCURSES_SRCDIR=c:\pdcurses
10# PDCURSES_BINDIR=c:\pdcurses
11# REXXTRANS_SRCDIR=c:\rexxtrans
12# REXXTRANS_BINDIR=c:\rexxtrans\gcc
13#
14#########################################################################
15#
16
17ifeq ($(AOUT),Y)
18LIBEXT=a
19OBJCFLAG=
20OBJLDFLAG=
21OBJLDFLAGOPT=
22OBJTYPE=o
23BIND=emxbind the
24LXLITE=
25else
26LIBEXT=lib
27OBJCFLAG=-Zomf
28OBJLDFLAG=-Zomf
29OBJLDFLAGOPT=-s
30OBJTYPE=obj
31BIND=
32LXLITE=lxlite the.exe
33endif
34
35SRC       = $(THE_SRCDIR)
36CURSBIN   = $(PDCURSES_BINDIR)
37CURSLIB   = $(PDCURSES_BINDIR)\curses.$(LIBEXT)
38CURSINC   = -I$(PDCURSES_SRCDIR)
39REGINA_REXXLIBS = $(REGINA_BINDIR)\regina.$(LIBEXT)
40REGINA_REXXINC = -I$(REGINA_SRCDIR) -DUSE_REGINA
41OS2REXX_REXXINC = -DUSE_OS2REXX
42REXXTRANS_REXXLIBS = $(REXXTRANS_BINDIR)\rexxtrans.$(LIBEXT)
43REXXTRANS_REXXINC = -I$(REXXTRANS_SRCDIR) -DUSE_REXXTRANS
44
45include $(SRC)\the.ver
46
47docdir = $(SRC)\doc
48HTML_EXT = .html
49
50COMM = \
51	$(SRC)\comm1.c \
52	$(SRC)\comm2.c \
53	$(SRC)\comm3.c \
54	$(SRC)\comm4.c \
55	$(SRC)\comm5.c
56
57COMMSOS = \
58	$(SRC)\commsos.c
59
60COMMSET = \
61	$(SRC)\commset1.c \
62	$(SRC)\commset2.c
63
64QUERY = $(SRC)\query.c
65
66APPENDIX1 = $(SRC)\appendix.1
67APPENDIX2 = $(SRC)\appendix.2
68APPENDIX3 = $(SRC)\appendix.3
69APPENDIX4 = $(SRC)\appendix.4
70APPENDIX7 = $(SRC)\appendix.7
71APPENDIX = $(APPENDIX1) $(APPENDIX2) $(APPENDIX3) $(APPENDIX4) $(APPENDIX7)
72
73GLOSSARY = $(SRC)\glossary
74OVERVIEW = $(SRC)\overview
75
76#########################################################################
77# EMX compiler on OS/2
78#########################################################################
79
80ifeq ($(INT),OS2REXX)
81REXXLIB = $(OS2REXX_REXXLIBS)
82REXXINC =  $(OS2REXX_REXXINC)
83endif
84ifeq ($(INT),REXXTRANS)
85REXXLIB = $(REXXTRANS_REXXLIBS)
86REXXINC =  $(REXXTRANS_REXXINC)
87endif
88ifeq ($(INT),REGINA)
89REXXLIB = $(REGINA_REXXLIBS)
90REXXINC =  $(REGINA_REXXINC)
91endif
92
93ifeq ($(DEBUG),Y)
94CFLAGS    = $(OBJCFLAG) -c -g -Wall -DEMX -DTHE_TRACE -DNOVIO -DSTDC_HEADERS -DHAVE_PROTO -I$(SRC) $(CURSINC) $(REXXINC) -o$@
95LDEBUG    = -g
96TRACE     = trace.$(OBJTYPE)
97LXLITE    =
98DEBUG     = N
99else
100CFLAGS    = $(OBJCFLAG) -c -O3 -fomit-frame-pointer -Wall -DEMX -DNOVIO -DSTDC_HEADERS -DHAVE_PROTO -I$(SRC) $(CURSINC) $(REXXINC) -o$@
101LDEBUG    = $(OBJLDFLAGOPT)
102TRACE     =
103endif
104
105LDFLAGS   = $(OBJLDFLAG) $(LDEBUG)
106
107CC        = gcc
108LD        = $(CC) $(LDFLAGS) -o the *.$(OBJTYPE) $(CURSLIB) $(REXXLIB)
109THERES    = $(SRC)\the.res
110RCTHE     = rc $(THERES) the.exe
111#########################################################################
112#
113#
114# Object files
115#
116OBJ1A = box.$(OBJTYPE) colour.$(OBJTYPE) comm1.$(OBJTYPE) comm2.$(OBJTYPE) comm3.$(OBJTYPE) comm4.$(OBJTYPE) comm5.$(OBJTYPE)
117OBJ1B = commset1.$(OBJTYPE) commset2.$(OBJTYPE) commsos.$(OBJTYPE) cursor.$(OBJTYPE) default.$(OBJTYPE)
118OBJ1C = edit.$(OBJTYPE) error.$(OBJTYPE) execute.$(OBJTYPE) linked.$(OBJTYPE) column.$(OBJTYPE) mouse.$(OBJTYPE)
119OBJ1D = nonansi.$(OBJTYPE) prefix.$(OBJTYPE) reserved.$(OBJTYPE) scroll.$(OBJTYPE) show.$(OBJTYPE) sort.$(OBJTYPE)
120OBJ1E = memory.$(OBJTYPE) target.$(OBJTYPE) the.$(OBJTYPE) util.$(OBJTYPE) parser.$(OBJTYPE)
121OBJ1 = $(OBJ1A) $(OBJ1B) $(OBJ1C) $(OBJ1D) $(OBJ1E)
122OBJ2 = commutil.$(OBJTYPE) print.$(OBJTYPE) $(TRACE)
123OBJ3 = getch.$(OBJTYPE)
124OBJ4 = query.$(OBJTYPE) query1.$(OBJTYPE) query2.$(OBJTYPE)
125OBJ5 = thematch.$(OBJTYPE) regex.$(OBJTYPE) mygetopt.$(OBJTYPE)
126OBJ6 = directry.$(OBJTYPE) file.$(OBJTYPE)
127OBJ7 = rexx.$(OBJTYPE)
128OBJ8 = os2eas.$(OBJTYPE)
129OBJOTH = $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8)
130OBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8)
131
132COMM = $(SRC)\comm1.c $(SRC)\comm2.c $(SRC)\comm3.c $(SRC)\comm4.c $(SRC)\comm5.c \
133	$(SRC)\commsos.c $(SRC)\commset1.c $(SRC)\commset2.c $(SRC)\query.c
134
135all: how the.exe dist
136
137how:
138	echo make -f $(SRC)\gccos2.mak DEBUG=$(DEBUG) INT=$(INT) > rebuild.cmd
139#
140#########################################################################
141the.exe:	$(OBJS)
142	@echo $(OBJ1A) > the.rsp
143	@echo $(OBJ1B) >> the.rsp
144	@echo $(OBJ1C) >> the.rsp
145	@echo $(OBJ1D) >> the.rsp
146	@echo $(OBJ1E) >> the.rsp
147	@echo $(OBJOTH) >> the.rsp
148	$(LD)
149	$(BIND)
150	del the.rsp
151	$(RCTHE)
152	$(LXLITE)
153#########################################################################
154box.$(OBJTYPE):	$(SRC)\box.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
155	$(CC) $(CFLAGS) $(SRC)\box.c
156colour.$(OBJTYPE):	$(SRC)\colour.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
157	$(CC) $(CFLAGS) $(SRC)\colour.c
158comm1.$(OBJTYPE):	$(SRC)\comm1.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
159	$(CC) $(CFLAGS) $(SRC)\comm1.c
160comm2.$(OBJTYPE):	$(SRC)\comm2.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
161	$(CC) $(CFLAGS) $(SRC)\comm2.c
162comm3.$(OBJTYPE):	$(SRC)\comm3.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
163	$(CC) $(CFLAGS) $(SRC)\comm3.c
164comm4.$(OBJTYPE):	$(SRC)\comm4.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
165	$(CC) $(CFLAGS) $(SRC)\comm4.c
166comm5.$(OBJTYPE):	$(SRC)\comm5.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
167	$(CC) $(CFLAGS) $(SRC)\comm5.c
168commset1.$(OBJTYPE):	$(SRC)\commset1.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
169	$(CC) $(CFLAGS) $(SRC)\commset1.c
170commset2.$(OBJTYPE):	$(SRC)\commset2.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
171	$(CC) $(CFLAGS) $(SRC)\commset2.c
172commsos.$(OBJTYPE):	$(SRC)\commsos.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
173	$(CC) $(CFLAGS) $(SRC)\commsos.c
174cursor.$(OBJTYPE):	$(SRC)\cursor.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
175	$(CC) $(CFLAGS) $(SRC)\cursor.c
176default.$(OBJTYPE):	$(SRC)\default.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
177	$(CC) $(CFLAGS) $(SRC)\default.c
178edit.$(OBJTYPE):	$(SRC)\edit.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
179	$(CC) $(CFLAGS) $(SRC)\edit.c
180error.$(OBJTYPE):	$(SRC)\error.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
181	$(CC) $(CFLAGS) $(SRC)\error.c
182execute.$(OBJTYPE):	$(SRC)\execute.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
183	$(CC) $(CFLAGS) $(SRC)\execute.c
184linked.$(OBJTYPE):	$(SRC)\linked.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
185	$(CC) $(CFLAGS) $(SRC)\linked.c
186column.$(OBJTYPE):	$(SRC)\column.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
187	$(CC) $(CFLAGS) $(SRC)\column.c
188mouse.$(OBJTYPE):	$(SRC)\mouse.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
189	$(CC) $(CFLAGS) $(SRC)\mouse.c
190memory.$(OBJTYPE):	$(SRC)\memory.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
191	$(CC) $(CFLAGS) $(SRC)\memory.c
192nonansi.$(OBJTYPE):	$(SRC)\nonansi.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
193	$(CC) $(CFLAGS) $(SRC)\nonansi.c
194os2eas.$(OBJTYPE):	$(SRC)\os2eas.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
195	$(CC) $(CFLAGS) $(SRC)\os2eas.c
196prefix.$(OBJTYPE):	$(SRC)\prefix.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
197	$(CC) $(CFLAGS) $(SRC)\prefix.c
198print.$(OBJTYPE):	$(SRC)\print.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
199	$(CC) $(CFLAGS) $(SRC)\print.c
200reserved.$(OBJTYPE):	$(SRC)\reserved.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
201	$(CC) $(CFLAGS) $(SRC)\reserved.c
202scroll.$(OBJTYPE):	$(SRC)\scroll.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
203	$(CC) $(CFLAGS) $(SRC)\scroll.c
204show.$(OBJTYPE):	$(SRC)\show.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
205	$(CC) $(CFLAGS) $(SRC)\show.c
206sort.$(OBJTYPE):	$(SRC)\sort.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
207	$(CC) $(CFLAGS) $(SRC)\sort.c
208target.$(OBJTYPE):	$(SRC)\target.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
209	$(CC) $(CFLAGS) $(SRC)\target.c
210the.$(OBJTYPE):	$(SRC)\the.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h $(SRC)\the.ver
211	$(CC) $(CFLAGS) -DTHE_VERSION=\"$(VER_DOT)\" -DTHE_VERSION_DATE=\"$(VER_DATE)\" $(SRC)\$*.c
212util.$(OBJTYPE):	$(SRC)\util.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
213	$(CC) $(CFLAGS) $(SRC)\util.c
214commutil.$(OBJTYPE):	$(SRC)\commutil.c $(SRC)\the.h $(SRC)\command.h $(SRC)\thedefs.h $(SRC)\proto.h $(SRC)\getch.h $(SRC)\key.h
215	$(CC) $(CFLAGS) $(SRC)\commutil.c
216trace.$(OBJTYPE):	$(SRC)\trace.c $(SRC)\the.h $(SRC)\command.h $(SRC)\thedefs.h $(SRC)\proto.h $(SRC)\getch.h $(SRC)\key.h
217	$(CC) $(CFLAGS) $(SRC)\trace.c
218getch.$(OBJTYPE):	$(SRC)\getch.c $(SRC)\getch.h $(SRC)\thedefs.h $(SRC)\proto.h
219	$(CC) $(CFLAGS) $(SRC)\getch.c
220query.$(OBJTYPE):	$(SRC)\query.c $(SRC)\query.h $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
221	$(CC) $(CFLAGS) $(SRC)\query.c
222query1.$(OBJTYPE):	$(SRC)\query1.c $(SRC)\query.h $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
223	$(CC) $(CFLAGS) $(SRC)\query1.c
224query2.$(OBJTYPE):	$(SRC)\query2.c $(SRC)\query.h $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
225	$(CC) $(CFLAGS) $(SRC)\query2.c
226thematch.$(OBJTYPE):	$(SRC)\thematch.c $(SRC)\the.h $(SRC)\thematch.h
227	$(CC) $(CFLAGS) $(SRC)\thematch.c
228parser.$(OBJTYPE):	$(SRC)\parser.c $(SRC)\the.h $(SRC)\thedefs.h $(SRC)\proto.h
229	$(CC) $(CFLAGS) $(SRC)\parser.c
230directry.$(OBJTYPE):	$(SRC)\directry.c $(SRC)\the.h $(SRC)\directry.h $(SRC)\thedefs.h $(SRC)\proto.h
231	$(CC) $(CFLAGS) $(SRC)\directry.c
232file.$(OBJTYPE):	$(SRC)\file.c $(SRC)\the.h $(SRC)\directry.h $(SRC)\thedefs.h $(SRC)\proto.h
233	$(CC) $(CFLAGS) $(SRC)\file.c
234rexx.$(OBJTYPE):	$(SRC)\rexx.c $(SRC)\the.h $(SRC)\therexx.h $(SRC)\proto.h $(SRC)\thedefs.h $(SRC)\query.h
235	$(CC) $(CFLAGS) $(SRC)\rexx.c
236regex.$(OBJTYPE):	$(SRC)\regex.c $(SRC)\regex.h
237	$(CC) $(CFLAGS) $(SRC)\regex.c
238mygetopt.$(OBJTYPE):	$(SRC)\mygetopt.c $(SRC)\mygetopt.h
239	$(CC) $(CFLAGS) $(SRC)\mygetopt.c
240########################################################################
241dist: the.exe
242	echo run $(SRC)\makedist.cmd
243#########################################################################
244
245manext.exe: manext.o
246	$(CC) manext.o -o manext
247	emxbind manext
248
249manext.o: $(SRC)\manext.c $(SRC)\the.h
250	$(CC) -c -I$(SRC) -o manext.o $(SRC)\manext.c
251
252html:	manext.exe
253	-del *$(HTML_EXT)
254	copy $(SRC)\man2html.rex .\man2html.cmd
255	man2html $(HTML_EXT) $(VER_DOT) TOCSTART > index$(HTML_EXT)
256	.\manext $(OVERVIEW) > overview.man
257	man2html $(HTML_EXT) $(VER_DOT) OVERVIEW overview.man index$(HTML_EXT) > overview$(HTML_EXT)
258	.\manext $(COMM) > comm.man
259	man2html $(HTML_EXT) $(VER_DOT) COMM comm.man index$(HTML_EXT) > comm$(HTML_EXT)
260	.\manext $(COMMSET) > commset.man
261	man2html $(HTML_EXT) $(VER_DOT) COMMSET commset.man index$(HTML_EXT) > commset$(HTML_EXT)
262	.\manext $(COMMSOS) > commsos.man
263	man2html $(HTML_EXT) $(VER_DOT) COMMSOS commsos.man index$(HTML_EXT) > commsos$(HTML_EXT)
264	.\manext $(QUERY) > query.man
265	man2html $(HTML_EXT) $(VER_DOT) QUERY    query.man index$(HTML_EXT)    > query$(HTML_EXT)
266	.\manext $(GLOSSARY) > glossary.man
267	man2html $(HTML_EXT) $(VER_DOT) GLOSSARY glossary.man index$(HTML_EXT) > glossary$(HTML_EXT)
268	.\manext $(APPENDIX1) > app1.man
269	man2html $(HTML_EXT) $(VER_DOT) APPENDIX1 app1.man index$(HTML_EXT) > app1$(HTML_EXT)
270	.\manext $(APPENDIX2) > app2.man
271	man2html $(HTML_EXT) $(VER_DOT) APPENDIX2 app2.man index$(HTML_EXT) > app2$(HTML_EXT)
272	.\manext $(APPENDIX3) > app3.man
273	man2html $(HTML_EXT) $(VER_DOT) APPENDIX3 app3.man index$(HTML_EXT) > app3$(HTML_EXT)
274	.\manext $(APPENDIX4) > app4.man
275	man2html $(HTML_EXT) $(VER_DOT) APPENDIX4 app4.man index$(HTML_EXT) > app4$(HTML_EXT)
276	man2html $(HTML_EXT) $(VER_DOT) APPENDIX5 $(docdir)\app5.htm index$(HTML_EXT) > app5$(HTML_EXT)
277	man2html $(HTML_EXT) $(VER_DOT) APPENDIX6 $(docdir)\app6.htm index$(HTML_EXT) > app6$(HTML_EXT)
278	.\manext $(APPENDIX7) > app7.man
279	man2html $(HTML_EXT) $(VER_DOT) APPENDIX7 app7.man index$(HTML_EXT) > app7$(HTML_EXT)
280	copy $(SRC)\HISTORY history.man
281	man2html $(HTML_EXT) $(VER_DOT) HISTORY history.man index$(HTML_EXT) > history$(HTML_EXT)
282	copy $(SRC)\THE_Help.txt quickref.man
283	man2html $(HTML_EXT) $(VER_DOT) QUICKREF quickref.man index$(HTML_EXT) > quickref$(HTML_EXT)
284	man2html $(HTML_EXT) $(VER_DOT) TOCEND >> index$(HTML_EXT)
285
286helpviewer:	manext.exe
287	-del \Y *$(HTML_EXT)
288	-del \Y *.man
289	-del \Y comm\\*.*
290	-del \Y commsos\\*.*
291	-del \Y commset\\*.*
292	-del \Y misc\\*.*
293	-mkdir comm
294	-mkdir commsos
295	-mkdir commset
296	-mkdir misc
297	copy $(SRC)\man2hv.rex .\man2hv.cmd
298	man2hv $(HTML_EXT) $(VER_DOT) TOCSTART 'junk' index$(HTML_EXT)
299	.\manext $(OVERVIEW) > overview.man
300	man2hv $(HTML_EXT) $(VER_DOT) OVERVIEW overview.man index$(HTML_EXT)
301	.\manext $(COMM) > comm.man
302	man2hv $(HTML_EXT) $(VER_DOT) COMM comm.man index$(HTML_EXT)
303	.\manext $(COMMSET) > commset.man
304	man2hv $(HTML_EXT) $(VER_DOT) COMMSET commset.man index$(HTML_EXT)
305	.\manext $(COMMSOS) > commsos.man
306	man2hv $(HTML_EXT) $(VER_DOT) COMMSOS commsos.man index$(HTML_EXT)
307	.\manext $(QUERY) > query.man
308	man2hv $(HTML_EXT) $(VER_DOT) QUERY    query.man index$(HTML_EXT)
309	.\manext $(GLOSSARY) > glossary.man
310	man2hv $(HTML_EXT) $(VER_DOT) GLOSSARY glossary.man index$(HTML_EXT)
311	.\manext $(APPENDIX1) > app1.man
312	man2hv $(HTML_EXT) $(VER_DOT) APPENDIX1 app1.man index$(HTML_EXT)
313	.\manext $(APPENDIX2) > app2.man
314	man2hv $(HTML_EXT) $(VER_DOT) APPENDIX2 app2.man index$(HTML_EXT)
315	.\manext $(APPENDIX3) > app3.man
316	man2hv $(HTML_EXT) $(VER_DOT) APPENDIX3 app3.man index$(HTML_EXT)
317	.\manext $(APPENDIX4) > app4.man
318	man2hv $(HTML_EXT) $(VER_DOT) APPENDIX4 app4.man index$(HTML_EXT)
319	man2hv $(HTML_EXT) $(VER_DOT) APPENDIX5 $(docdir)\app5.htm index$(HTML_EXT)
320	man2hv $(HTML_EXT) $(VER_DOT) APPENDIX6 $(docdir)\app6.htm index$(HTML_EXT)
321	.\manext $(APPENDIX7) > app7.man
322	man2hv $(HTML_EXT) $(VER_DOT) APPENDIX7 app7.man index$(HTML_EXT)
323	copy $(SRC)\HISTORY history.man
324	man2hv $(HTML_EXT) $(VER_DOT) HISTORY history.man index$(HTML_EXT)
325	copy $(SRC)\THE_Help.txt quickref.man
326	man2hv $(HTML_EXT) $(VER_DOT) QUICKREF quickref.man index$(HTML_EXT)
327	man2hv $(HTML_EXT) $(VER_DOT) TOCEND 'junk' index$(HTML_EXT)
328