Debian Codegraph @

Makefile.wat

raw
1 ##########################################################################
2 # This program is Copyright (C) 1986-2002 by Jonathan Payne. JOVE is #
3 # provided by Jonathan and Jovehacks without charge and without #
4 # warranty. You may copy, modify, and/or distribute JOVE, provided that #
5 # this notice is included in all the source files and documentation. #
6 ##########################################################################
7
8 # wmake -f makefile.wat [<targets>]
9
10 # Makefile for Watcom C 10.0
11 #
12 # - supported targets:
13 # + jjove.exe (build JOVE, but don't install it)
14 # + jovedosx.zip (build executable JOVE kit)
15 # + clean
16 #
17 # - to install, do the following:
18 # + copy jjove.exe where you wish
19 # + copy doc/cmds.txt to <SHAREDIR>/cmds.txt
20 # + optional: copy some jove rc (none supplied) file to <SHAREDIR>/jove.rc
21
22 # Watcom Quirks:
23 # - "&" is used instead of "\" as the continuation character
24 # - .SYMBOLIC is needed it a rule doesn't create the target (eg. "clean")
25 # - .AUTODEPEND picks up dependencies recorded in .obj files
26 # - stack size is specified using -k
27 # - "*" at the start of a command will work around >128 char args.
28 # For some reason, I couldn't get this to work, so I used *.obj
29 # in the link step -- a bit fragile!
30 # - To get wild-card processing of command-line args, we must
31 # link in wildargv.obj (which we must build -- see below).
32
33 # ===================================================================
34 # Jove configuration: default JOVE paths.
35 # Note that all these can be set from environment variables as well;
36 # see README.DOS for details.
37 #
38 # TMPDIR is where the tmp files get stored, usually /tmp or /usr/tmp.
39 # RECDIR is the directory in which RECOVER looks for JOVE's tempfiles.
40 # LIBDIR is for the PORTSRV and RECOVER programs.
41 # SHAREDIR is for online documentation, and the system-wide jove.rc file.
42 ## BINDIR is where to put the executables JOVE
43 # DFLTSHELL is the default shell invoked by JOVE.
44
45 TMPDIR = c:/tmp
46 RECDIR = c:/tmp
47 # BINDIR = c:/jove
48 # LIBDIR and SHAREDIR are relative to executable directory
49 LIBDIR =
50 SHAREDIR = doc
51 DFLTSHELL = command
52
53 # Compiler:
54
55 CC = wcc
56
57 # Watcom Compiler Flags:
58 #
59 # -d2 full symbolic debugging information
60 # -fo=<file_name> set object or preprocessor output file name
61 # -i=<directory> another include directory
62 # -m{s,m,c,l,h} memory model (Small,Medium,Compact,Large,Huge)
63 # -w<number> set warning level number
64 # -wx generate all warnings
65 # -zq operate quietly (diagnostics are not suppressed)
66 # -zt<number> put objects greater than <number> bytes in far segments
67 # -os optimize for size over speed
68 # -ot optimize for speed over size
69 # -s do not add stack overflow check code
70 #
71 # Same as UNIX:
72 # -d<name>[=text] precompilation #define name [text]
73 # NOTE: quotes around the macro body in a -D are actually taken as part
74 # of that body!!
75
76 # -ms (small mode) cannot be used (Jove is about 15K over the 64K code limit,
77 # even with -DBAREBONES, and OPTFLAGS="-os -s")
78 # -mm (medium mode) builds with very few I/O buffers, and 512-byte max line
79 # length. Might run out of tmp file space or heap memory if editing many
80 # files.
81 # -ml (large mode) is recommended, has more buffers (so should be faster
82 # for normal use), 2K max line length, takes advantage of all heap memory
83 # so can keep a very large number of files open.
84 # 640K ought to be enough for anyone!
85 MODEL = -ml
86 OPTFLAGS = -os # optimize for size over speed
87 CFLAGS = $(MODEL) $(OPTFLAGS) -wx -zq -zt200 -dOWCDOS=1
88
89 # Linker:
90
91 LD = wcl
92
93 # Watcom wcl (Watcom Compile/Link) Link Flags:
94 #
95 # -fe=<file_name> set .exec output file name
96 # -fm generate .map file
97 # -kN allocate N bytes for stack
98 # -x make case of names significant
99 # N for stack may need to be lowered if linking complains that
100 # DGROUP is too large (reduce it by the number of bytes in the
101 # complaint). Alternatively, maybe decrease CFLAGS zt (moves
102 # more objects to far, presumably a tad slower, bigger code footprint?)
103 # https://open-watcom.github.io/open-watcom-v2-wikidocs/pguide.html#What_does__size_of_DGROUP_exceeds_64K__mean_for_16Mbit_applications_
104
105 STACKSIZE = 18000
106 LDFLAGS = $(CFLAGS) -x -k$(STACKSIZE)
107
108 # ===================================================================
109 # Implicit rules.
110
111 .c.obj: .AUTODEPEND
112 $(CC) $(CFLAGS) $<
113
114 .obj.exe:
115 $(LD) $(LDFLAGS) $<
116
117
118 OBJECTS = keys.obj commands.obj abbrev.obj ask.obj buf.obj c.obj &
119 case.obj jctype.obj delete.obj extend.obj argcount.obj insert.obj &
120 io.obj jove.obj macros.obj marks.obj misc.obj mouse.obj move.obj &
121 para.obj proc.obj re.obj reapp.obj rec.obj scandir.obj list.obj &
122 keymaps.obj util.obj vars.obj wind.obj fmt.obj disp.obj term.obj &
123 fp.obj screen.obj msgetch.obj ibmpcdos.obj
124
125 HEADERS = abbrev.h argcount.h ask.h buf.h c.h case.h chars.h commands.h &
126 jctype.h dataobj.h delete.h disp.h extend.h externs.h &
127 fmt.h fp.h insert.h io.h iproc.h jove.h &
128 keymaps.h list.h mac.h macros.h marks.h &
129 misc.h mouse.h move.h para.h proc.h &
130 re.h reapp.h rec.h scandir.h screen.h &
131 sysdep.h temp.h term.h ttystate.h &
132 tune.h util.h vars.h version.h wind.h
133
134 all: jjove.exe recover.exe
135
136 #
137 # For this reason, we can only force the building of paths.h
138 # by adding it to the dependencies for explicit targets.
139 # In the hope that it is built soon enough, we put it at the front.
140 # To avoid over-long cmd line, we use *.obj for jjove link,
141 # which means we have to ensure recover or setmaps use one-step
142 # compile-and-link and do not leave .obj lying around.
143
144 # * $(LD) $(LDFLAGS) -fe=$* $(OBJECTS)
145 jjove.exe: paths.h $(OBJECTS) wildargv.obj
146 -del recover.obj
147 -del setmaps.obj
148 $(LD) $(LDFLAGS) -fm -fe=$* *.obj
149
150 recover.exe: recover.c
151 wcl $(CFLAGS) $(LDFLAGS) $< -fe=$@ $<
152
153 # Complains about an overly long command
154 # $(OBJECTS): $(HEADERS)
155
156 jovedosx.zip: paths.h jjove.exe
157 -del jovedosx.zip
158 -del jove.exe
159 rename jjove.exe jove.exe
160 pkzip -aP jovedosx.zip jove.exe recover.exe doc\*.* paths.h README.dos changelg.txt
161
162 # Note that quotes are not stripped by the shell that will
163 # execute the recipe for paths.h
164
165 paths.h: Makefile.wat
166 @echo Making <<paths.h
167 /* Changes should be made in Makefile.wat, not to this file! */
168
169 #define TMPDIR "$(TMPDIR)"
170 #define RECDIR "$(RECDIR)"
171 #define LIBDIR "$(LIBDIR)"
172 #define SHAREDIR "$(SHAREDIR)"
173 #define TEACHJOVE "teachjov.txt"
174 #define DFLTSHELL "$(DFLTSHELL)"
175 <<KEEP
176
177 setmaps.exe: setmaps.c commands.tab
178 wcl $(CFLAGS) $(LDFLAGS) setmaps.c -fe=$@
179
180 keys.c: setmaps.exe keys.txt
181 setmaps < keys.txt > keys.c
182
183 # Note: it may be necessary to manually copy the source file from
184 # the distribution CDROM to the installation. On the CDROM, the
185 # file's path is \watcom\src\startup\wildargv.c.
186 # The latest versions at github need newer compilers than 1.9.0
187 # https://github.com/open-watcom/open-watcom-v2/master/bld/clib/startup/c/wildargv.c
188 # At least with some versions (fixed in the github version), wildargv.c does not accept tabs as
189 # argument delimiters. This should be fixed.
190 # Change line 82 from:
191 # while( *p == ' ' ) ++p; /* skip over blanks */
192 # to:
193 # while( *p == ' ' || *p == '\t' ) ++p; /* skip over blanks */
194 # Change line 103 from:
195 # if( *p == ' ' ) break;
196 # to:
197 # if( *p == ' ' || *p == '\t' ) break;
198
199 WILDSRC=$(%WATCOM)\src\startup\wildargv.c
200
201 wildargv.obj: $(WILDSRC)
202 $(CC) $(CFLAGS) $(WILDSRC)
203
204 clean: .SYMBOLIC
205 -del *.obj
206 -del *.exe
207 -del *.bak
208 -del *.map
209 -del keys.c