source: trunk/dll/makefile@ 1036

Last change on this file since 1036 was 1022, checked in by Steven Levine, 17 years ago

Update WARNALL to warn about more

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