source: trunk/dll/makefile@ 1567

Last change on this file since 1567 was 1514, checked in by Steven Levine, 16 years ago

Rework makefiles dropping support for obsolete HIMEM setting

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