1 | # dll\makefile - build fm/2 dlls, help files, string tables and resource kit
|
---|
2 | # $Id: makefile 1133 2008-08-30 04:27:29Z stevenhl $
|
---|
3 |
|
---|
4 | # Copyright (c) 1993-98 M. Kimes
|
---|
5 | # Copyright (c) 2002, 2008 Steven H. Levine
|
---|
6 |
|
---|
7 | # 22 May 03 SHL Correct icon dependencies
|
---|
8 | # 21 Nov 03 SHL Correct ipf dependents
|
---|
9 | # 26 Jul 04 SHL Correct CFLAGSR
|
---|
10 | # 23 May 05 SHL Drop saymsg
|
---|
11 | # 24 May 05 SHL Add clean and cleanobj targets
|
---|
12 | # 06 Jun 05 SHL Add warnings enable (WARN)
|
---|
13 | # 24 Jul 05 SHL Rework resource kit support
|
---|
14 | # 16 Apr 06 SHL Add lxlite target
|
---|
15 | # 28 Jun 06 SHL Add more .h dependencies
|
---|
16 | # 22 Jul 06 SHL Add more .h dependencies
|
---|
17 | # 29 Jul 06 SHL Reorganize icons
|
---|
18 | # 31 Jul 06 SHL Tweak dependencies
|
---|
19 | # 16 Aug 06 SHL Drop 4os2-ism
|
---|
20 | # 18 Aug 06 SHL Drop rc -x2 compression - not reliable
|
---|
21 | # 01 Sep 06 SHL fm3.hlp: add missing dependency on ..\bitmaps
|
---|
22 | # 01 Sep 06 SHL Adjust fm3str.str case
|
---|
23 | # 30 Sep 06 GKY Add del of Help file to clean
|
---|
24 | # 19 Oct 06 SHL Move all .hlp logic build to ipf\makefile too
|
---|
25 | # 12 May 07 SHL Drop obsolete macros
|
---|
26 | # 02 Jun 07 SHL Convert to OpenWatcom
|
---|
27 | # 27 Jun 07 SHL Allow DEBUG set from command line or environment
|
---|
28 | # 03 Jul 07 SHL Change DEBUG semantics to ifdef/ifndef
|
---|
29 | # 04 Jul 07 SHL Pass DEBUG settings to sub-make
|
---|
30 | # 04 Jul 07 SHL Add missing .autodepend
|
---|
31 | # 06 Aug 07 SHL Tweak CFLAGS for DEBUG builds
|
---|
32 | # 26 Aug 07 SHL Clean *.lrf
|
---|
33 | # 05 Sep 07 SHL Correct USE_WRC logic
|
---|
34 | # 22 Sep 07 SHL Switch to 4 byte packing (-zp4)
|
---|
35 | # 03 Jan 08 SHL Prepare for final, implending switch to wrc.exe
|
---|
36 | # 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment
|
---|
37 | # 05 Jan 08 SHL Sync with .c renames
|
---|
38 | # 22 Feb 08 JBS Suppress lxlite processing when DEBUG=1
|
---|
39 | # 01 Mar 08 SHL Add missing dependencies. Add WARNALL support
|
---|
40 | # 05 May 08 SHL Add FORTIFY support
|
---|
41 | # 26 May 08 SHL Update WARNALL to warn about more
|
---|
42 | # 22 Jul 08 SHL Change from dllsyms to syms target for consistency
|
---|
43 |
|
---|
44 | # Environment:
|
---|
45 |
|
---|
46 | # DEBUG - not defined = release build, defined = debug build
|
---|
47 | # WARNALL - add more warnings if defined
|
---|
48 | # FORTIFY - build with FORTIFYed memory
|
---|
49 |
|
---|
50 | BASE = fm3dll
|
---|
51 | BASERES = fm3res
|
---|
52 |
|
---|
53 | .SUFFIXES:
|
---|
54 | .SUFFIXES: .obj .c .res .rc .ipf
|
---|
55 |
|
---|
56 | CC = wcc386
|
---|
57 | LINK = wlink
|
---|
58 |
|
---|
59 | !ifndef USE_RC # if not defined on command line
|
---|
60 | !ifdef %USE_RC # if defined in environment
|
---|
61 | USE_RC = $(%USE_RC)
|
---|
62 | !else
|
---|
63 | USE_RC = 0
|
---|
64 | !endif
|
---|
65 | !endif
|
---|
66 |
|
---|
67 | !if $(USE_RC)
|
---|
68 | RC = rc
|
---|
69 | !else
|
---|
70 | RC = wrc
|
---|
71 | !endif
|
---|
72 |
|
---|
73 | # Keep this code in sync with makefile_pre.mk
|
---|
74 | !ifdef DEBUG # if defined on wmake command line
|
---|
75 | DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
|
---|
76 | !else
|
---|
77 | !ifdef %DEBUG # if defined in environment
|
---|
78 | DEBUG = $(%DEBUG) # use value from environment
|
---|
79 | DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
|
---|
80 | !endif
|
---|
81 | !endif
|
---|
82 |
|
---|
83 | !ifdef %WARNALL # if defined in environment
|
---|
84 | WARNALL = $(%WARNALL) # use value from environment
|
---|
85 | !endif
|
---|
86 |
|
---|
87 | !ifdef %FORTIFY # if defined in environment
|
---|
88 | FORTIFY = $(%FORTIFY) # use value from environment
|
---|
89 | !endif
|
---|
90 |
|
---|
91 | SYMS = $(BASE).sym $(BASERES).sym internal\mkstr.sym #set a targets for building SYM files
|
---|
92 |
|
---|
93 | # Some flags are order dependent - see OpenWatcom docs
|
---|
94 | # -bc console app
|
---|
95 | # -bd build target is a Dynamic Link Library (DLL)
|
---|
96 | # -bg gui app with WinMain entry point
|
---|
97 | # -bm multithread libs
|
---|
98 | # -bt=os2 target
|
---|
99 | # -d1 line number debugging information
|
---|
100 | # -d2 full symbolic debugging information
|
---|
101 | # -d3 full debug w/unref
|
---|
102 | # -hd dwarf
|
---|
103 | # -j signed char
|
---|
104 | # -mf flat
|
---|
105 | # -of generate traceable stack frames
|
---|
106 | # -olinars optimze loops, inline, e(n)able fp recip, relax (a)lias, reordering, space
|
---|
107 | # -s disable stack checks
|
---|
108 | # -sg generate calls to grow the stack
|
---|
109 | # -st touch stack through SS first
|
---|
110 | # -we treat warnings as errors
|
---|
111 | # -wx max warnings
|
---|
112 | # -zfp disable fs use
|
---|
113 | # -zgp disable gs use
|
---|
114 | # -zp4 align 4
|
---|
115 | # -zq quiet
|
---|
116 |
|
---|
117 | # -wx excludes these
|
---|
118 | # See GenCOptions() in openwatcom\bld\cc\c\coptions.c
|
---|
119 | # -wce130 possible loss of precision
|
---|
120 | # -wcd=303 no reference to formal parameter
|
---|
121 | # -wcd=307 obsolete non-prototype declarator
|
---|
122 | # -wcd=308 unprototyped function called
|
---|
123 | # -wcd=309 unprototyped function called indirectly
|
---|
124 |
|
---|
125 | !ifdef DEBUG
|
---|
126 | CFLAGS = -bt=os2 -mf -bd -bm -hd -d2 -olirs -s -sg -j -wx -zfp -zgp -zp4 -zq
|
---|
127 | CFLAGS = -bt=os2 -mf -bd -bm -hd -d2 -s -sg -j -wx -zfp -zgp -zp4 -zq
|
---|
128 | !else
|
---|
129 | CFLAGS = -bt=os2 -mf -bd -bm -hd -d1 -olirs -s -sg -j -wx -zfp -zgp -zp4 -zq
|
---|
130 | !endif
|
---|
131 |
|
---|
132 | # 26 May 08 SHL Was reversed
|
---|
133 | !ifdef WARNALL
|
---|
134 | CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
|
---|
135 | !else
|
---|
136 | CFLAGS += -we
|
---|
137 | !endif
|
---|
138 |
|
---|
139 | !ifdef FORTIFY
|
---|
140 | CFLAGS += -dFORTIFY
|
---|
141 | !endif
|
---|
142 |
|
---|
143 | # for fm3res only
|
---|
144 | CFLAGSR = -bt=os2 -mf -bd -bm -olirs -s -j -we -wx -zfp -zgp -zp4 -zq
|
---|
145 |
|
---|
146 | !ifdef DEBUG
|
---|
147 | LFLAGS = sys os2v2_dll initinstance terminstance op quiet op verbose op cache &
|
---|
148 | op caseexact op implib op map debug dwarf all
|
---|
149 | !else
|
---|
150 | LFLAGS = sys os2v2_dll initinstance terminstance op quiet op verbose op cache &
|
---|
151 | op caseexact op implib op map
|
---|
152 | !endif
|
---|
153 |
|
---|
154 | # rc Includes can be in current director or dll subdirectory
|
---|
155 | !if $(USE_RC)
|
---|
156 | RCFLAGS = -r -i dll
|
---|
157 | RCFLAGS2 = -x2
|
---|
158 | !else
|
---|
159 | # Pass 1 flags
|
---|
160 | RCFLAGS = -r -i=dll -ad
|
---|
161 | # Pass 2 flags
|
---|
162 | RCFLAGS2 =
|
---|
163 | !endif
|
---|
164 |
|
---|
165 | !ifndef MAKERES
|
---|
166 | .c.obj: .autodepend
|
---|
167 | $(CC) $(CFLAGS) $*.c
|
---|
168 | !else
|
---|
169 | # !error "MAKERES mode"
|
---|
170 | !endif
|
---|
171 |
|
---|
172 | OBJS = arccnrs.obj archive.obj assoc.obj attribs.obj autoview.obj &
|
---|
173 | avl.obj avv.obj chklist.obj cmdline.obj codepage.obj &
|
---|
174 | collect.obj colors.obj commafmt.obj command.obj common.obj &
|
---|
175 | comp.obj copyf.obj datamin.obj defview.obj delims.obj dircnrs.obj &
|
---|
176 | dirs.obj dirsize.obj draglist.obj droplist.obj eas.obj errutil.obj &
|
---|
177 | extract.obj filldir.obj filter.obj findrec.obj flesh.obj fm2cmd.obj &
|
---|
178 | fonts.obj fortify.obj fsopen.obj &
|
---|
179 | getnames.obj grep.obj grep2.obj info.obj inis.obj &
|
---|
180 | init.obj input.obj instant.obj key.obj killproc.obj literal.obj &
|
---|
181 | loadbmp.obj mainwnd.obj mainwnd2.obj makelist.obj menu.obj misc.obj &
|
---|
182 | mkdir.obj mle.obj newview.obj notebook.obj notify.obj objcnr.obj &
|
---|
183 | objwin.obj &
|
---|
184 | pathutil.obj &
|
---|
185 | presparm.obj printer.obj remap.obj rename.obj saveclip.obj &
|
---|
186 | seeall.obj select.obj seticon.obj shadow.obj sortcnr.obj srchpath.obj &
|
---|
187 | strutil.obj strips.obj stristr.obj subj.obj sysinfo.obj systemf.obj &
|
---|
188 | timer.obj tmrsvcs.obj tools.obj treecnr.obj &
|
---|
189 | undel.obj update.obj uudecode.obj &
|
---|
190 | valid.obj viewer.obj viewinf.obj walkem.obj winlist.obj worker.obj &
|
---|
191 | wrappers.obj
|
---|
192 |
|
---|
193 | ICONS = icons\*.ico ..\icons\*.ico icons\*.ptr
|
---|
194 |
|
---|
195 | !ifndef MAKERES
|
---|
196 |
|
---|
197 | all: &
|
---|
198 | $(BASE).dll &
|
---|
199 | $(BASERES).res &
|
---|
200 | $(BASERES).dll &
|
---|
201 | ipf\fm3.hlp &
|
---|
202 | internal\mkstr.exe &
|
---|
203 | fm3res.str
|
---|
204 |
|
---|
205 | syms: $(SYMS) .symbolic
|
---|
206 |
|
---|
207 | $(BASE).dll $(BASE).lib: $(OBJS) $(BASE).def $(BASE).lrf
|
---|
208 | @echo $(LINK) @$(BASE).lrf @$(BASE).def
|
---|
209 | $(LINK) @$(BASE).lrf @$(BASE).def
|
---|
210 | @rem type $(BASE).lrf
|
---|
211 | bldlevel $@
|
---|
212 |
|
---|
213 | $(BASE).lrf: $(__MAKEFILES__)
|
---|
214 | @%write $^@ $(LFLAGS)
|
---|
215 | @%append $^@ name $(BASE)
|
---|
216 | @for %f in ($(OBJS)) do @%append $^@ file %f
|
---|
217 | !ifdef %EXCEPTQ
|
---|
218 | @%append $^@ file exceptq.lib
|
---|
219 | !endif
|
---|
220 | @%append $^@ library os2386.lib
|
---|
221 |
|
---|
222 | !else
|
---|
223 |
|
---|
224 | # MAKERES mode - build resources only
|
---|
225 |
|
---|
226 | all: chkexe &
|
---|
227 | $(BASERES).res &
|
---|
228 | $(BASERES).dll &
|
---|
229 | ipf\fm3.hlp &
|
---|
230 | fm3res.str
|
---|
231 |
|
---|
232 | chkexe:
|
---|
233 | @echo Checking required EXEs
|
---|
234 | if not exist internal\mkstr.exe internal\mkstr.exe
|
---|
235 | !ifndef DEBUG
|
---|
236 | lxlite -c:exehdr internal\mkstr.exe >nul
|
---|
237 | !else
|
---|
238 | ! ifeq DEBUG 0
|
---|
239 | lxlite -c:exehdr internal\mkstr.exe >nul
|
---|
240 | ! endif
|
---|
241 | !endif
|
---|
242 |
|
---|
243 | !endif
|
---|
244 |
|
---|
245 | # Update resources only
|
---|
246 |
|
---|
247 | res:
|
---|
248 | @echo Updating resources only
|
---|
249 | $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) MAKERES=1
|
---|
250 |
|
---|
251 | internal\mkstr.exe: internal\mkstr.c version.h fm3str.h
|
---|
252 | cd internal
|
---|
253 | $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT)
|
---|
254 | cd..
|
---|
255 |
|
---|
256 | $(BASERES).obj: $(BASERES).c .autodepend
|
---|
257 | $(CC) $(CFLAGSR) $(BASERES).c
|
---|
258 |
|
---|
259 | $(BASERES).res: *.rc *.dlg fm3dll2.h fm3dlg.h $(ICONS)
|
---|
260 | $(RC) $(RCFLAGS) $*
|
---|
261 | !if $(USE_RC)
|
---|
262 | ren $*.res $*.res
|
---|
263 | !endif
|
---|
264 |
|
---|
265 | !ifndef MAKERES
|
---|
266 |
|
---|
267 | $(BASERES).dll $(BASERES).lib: $(BASERES).res $(BASERES).obj $(BASERES).def $(BASERES).lrf
|
---|
268 | @echo $(LINK) @$(BASERES).lrf @$(BASERES).def
|
---|
269 | $(LINK) @$(BASERES).lrf @$(BASERES).def
|
---|
270 | $(RC) $(RCFLAGS2) $(BASERES).res $@
|
---|
271 | bldlevel $@
|
---|
272 |
|
---|
273 | $(BASERES).lrf: $(__MAKEFILES__)
|
---|
274 | @%write $^@ $(LFLAGS)
|
---|
275 | @%append $^@ name $(BASERES)
|
---|
276 | @for %f in ($(BASERES).obj) do @%append $^@ file %f
|
---|
277 |
|
---|
278 | $(BASE).sym: $(BASE).map
|
---|
279 | @echo Processing: $?
|
---|
280 | -perl ..\debugtools\mapsymw.pl $?
|
---|
281 |
|
---|
282 | $(BASERES).sym: $(BASERES).map
|
---|
283 | @echo Processing: $?
|
---|
284 | -perl ..\debugtools\mapsymw.pl $?
|
---|
285 |
|
---|
286 | internal\mkstr.sym: internal\mkstr.map
|
---|
287 | @echo Processing: $?
|
---|
288 | cd internal
|
---|
289 | -perl ..\..\debugtools\mapsymw.pl mkstr.map
|
---|
290 | cd ..
|
---|
291 |
|
---|
292 | !else
|
---|
293 |
|
---|
294 | # MAKERES mode - build resources only
|
---|
295 |
|
---|
296 | $(BASERES).dll: $(BASERES).res
|
---|
297 | @if not exist $@ echo $@ missing
|
---|
298 | !ifndef DEBUG
|
---|
299 | lxlite $@ /x+ /b-
|
---|
300 | lxlite $@ /c:minstub
|
---|
301 | !else
|
---|
302 | ! ifeq DEBUG 0
|
---|
303 | lxlite $@ /x+ /b-
|
---|
304 | lxlite $@ /c:minstub
|
---|
305 | ! endif
|
---|
306 | !endif
|
---|
307 | $(RC) $(RCFLAGS2) $(BASERES).res $@
|
---|
308 | !ifndef DEBUG
|
---|
309 | lxlite $@ /x- /b-
|
---|
310 | !else
|
---|
311 | ! ifeq DEBUG 0
|
---|
312 | lxlite $@ /x- /b-
|
---|
313 | ! endif
|
---|
314 | !endif
|
---|
315 | bldlevel $@
|
---|
316 |
|
---|
317 | !endif # MAKERES mode
|
---|
318 |
|
---|
319 | # For testing new code
|
---|
320 | tmp.obj: tmp.c
|
---|
321 |
|
---|
322 | $(BASERES).str: $(BASE).str fm3str.h version.h
|
---|
323 | internal\mkstr
|
---|
324 | # ren $(BASERES).str $(BASERES).str
|
---|
325 | copy $(BASERES).str ..\ /v
|
---|
326 |
|
---|
327 | ipf: ipf\fm3.hlp .symbolic
|
---|
328 |
|
---|
329 | ipf\fm3.hlp: ipf\*.ipf ipf\bitmaps\*.bmp ipf\makefile
|
---|
330 | cd ipf
|
---|
331 | $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) fm3.hlp
|
---|
332 | cd..
|
---|
333 |
|
---|
334 | # Run for each dependent
|
---|
335 | lxlite: $(BASE).dll $(BASERES).dll .symbolic
|
---|
336 | # !lxlite /x- /b- $?
|
---|
337 | !ifndef DEBUG
|
---|
338 | @for %f in ($(BASE).dll $(BASERES).dll) do !lxlite /x- /b- %f
|
---|
339 | !else
|
---|
340 | ! ifeq DEBUG 0
|
---|
341 | @for %f in ($(BASE).dll $(BASERES).dll) do !lxlite /x- /b- %f
|
---|
342 | ! endif
|
---|
343 | !endif
|
---|
344 |
|
---|
345 | cleanobj: .symbolic
|
---|
346 | cd internal
|
---|
347 | $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) cleanobj
|
---|
348 | cd..
|
---|
349 | -del *.obj
|
---|
350 |
|
---|
351 | clean: .symbolic
|
---|
352 | cd internal
|
---|
353 | $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean
|
---|
354 | cd ..\ipf
|
---|
355 | $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean
|
---|
356 | cd..
|
---|
357 | -del *.dll
|
---|
358 | -del *.lib
|
---|
359 | -del *.lrf
|
---|
360 | -del *.map
|
---|
361 | -del *.obj
|
---|
362 | -del *.res
|
---|
363 | -del *.sym
|
---|
364 | -del fm3res.str
|
---|