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
RevLine 
[72]1# dll\makefile - build fm/2 dlls, help files, string tables and resource kit
[62]2# $Id: makefile 1022 2008-05-27 05:45:35Z stevenhl $
[21]3
[415]4# Copyright (c) 1993-98 M. Kimes
[899]5# Copyright (c) 2002, 2008 Steven H. Levine
[415]6
[134]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
[146]11# 24 May 05 SHL Add clean and cleanobj targets
[220]12# 06 Jun 05 SHL Add warnings enable (WARN)
[261]13# 24 Jul 05 SHL Rework resource kit support
[310]14# 16 Apr 06 SHL Add lxlite target
[314]15# 28 Jun 06 SHL Add more .h dependencies
[360]16# 22 Jul 06 SHL Add more .h dependencies
[408]17# 29 Jul 06 SHL Reorganize icons
[414]18# 31 Jul 06 SHL Tweak dependencies
[454]19# 16 Aug 06 SHL Drop 4os2-ism
20# 18 Aug 06 SHL Drop rc -x2 compression - not reliable
[479]21# 01 Sep 06 SHL fm3.hlp: add missing dependency on ..\bitmaps
[482]22# 01 Sep 06 SHL Adjust fm3str.str case
[525]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
[673]25# 12 May 07 SHL Drop obsolete macros
[691]26# 02 Jun 07 SHL Convert to OpenWatcom
[719]27# 27 Jun 07 SHL Allow DEBUG set from command line or environment
28# 03 Jul 07 SHL Change DEBUG semantics to ifdef/ifndef
[720]29# 04 Jul 07 SHL Pass DEBUG settings to sub-make
[721]30# 04 Jul 07 SHL Add missing .AUTODEPEND
[808]31# 06 Aug 07 SHL Tweak CFLAGS for DEBUG builds
32# 26 Aug 07 SHL Clean *.lrf
[833]33# 05 Sep 07 SHL Correct USE_WRC logic
[841]34# 22 Sep 07 SHL Switch to 4 byte packing (-zp4)
[899]35# 03 Jan 08 SHL Prepare for final, implending switch to wrc.exe
[903]36# 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment
[907]37# 05 Jan 08 SHL Sync with .c renames
[973]38# 22 Feb 08 JBS Suppress lxlite processing when DEBUG=1
[1003]39# 01 Mar 08 SHL Add missing dependencies. Add WARNALL support
[1005]40# 05 May 08 SHL Add FORTIFY support
[1022]41# 26 May 08 SHL Update WARNALL to warn about more
[62]42
[72]43# Environment:
44
[808]45# DEBUG - not defined = release build, defined = debug build
[1003]46# WARNALL - add more warnings if defined
[1005]47# FORTIFY - build with FORTIFYed memory
[72]48
[691]49BASE = fm3dll
50BASERES = fm3res
[2]51
[691]52.SUFFIXES:
53.SUFFIXES: .obj .c .res .rc .ipf
[2]54
[691]55CC = wcc386
56LINK = wlink
57
[903]58!ifndef USE_RC # if not defined on command line
59!ifdef %USE_RC # if defined in environment
60USE_RC = $(%USE_RC)
[833]61!else
[903]62USE_RC = 0
[719]63!endif
[833]64!endif
[691]65
[903]66!if $(USE_RC)
67RC = rc
68!else
[691]69RC = wrc
[261]70!endif
[2]71
[719]72# Keep this code in sync with makefile_pre.mk
[808]73!ifdef DEBUG # if defined on wmake command line
[720]74DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
75!else
[808]76!ifdef %DEBUG # if defined in environment
77DEBUG = $(%DEBUG) # use value from environment
[720]78DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
[719]79!endif
80!endif
81
[1003]82!ifdef %WARNALL # if defined in environment
83WARNALL = $(%WARNALL) # use value from environment
84!endif
85
[1005]86!ifdef %FORTIFY # if defined in environment
87FORTIFY = $(%FORTIFY) # use value from environment
88!endif
89
[976]90SYMS = $(BASE).sym $(BASERES).sym internal\mkstr.sym #set a targets for building SYM files
91
[691]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
[808]98# -d1 line number debugging information
[734]99# -d2 full symbolic debugging information
[691]100# -d3 full debug w/unref
101# -hd dwarf
102# -j signed char
103# -mf flat
[808]104# -of generate traceable stack frames
[691]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
[907]109# -we treat warnings as errors
[691]110# -wx max warnings
111# -zfp disable fs use
112# -zgp disable gs use
113# -zp4 align 4
114# -zq quiet
[261]115
[1022]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
[719]124!ifdef DEBUG
[1022]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
[691]127!else
[1022]128CFLAGS = -bt=os2 -mf -bd -bm -hd -d1 -olirs -s -sg -j -wx -zfp -zgp -zp4 -zq
[261]129!endif
[220]130
[1022]131# 26 May 08 SHL Was reversed
[1003]132!ifdef WARNALL
[1022]133CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
134!else
135CFLAGS += -we
[1003]136!endif
137
[1005]138!ifdef FORTIFY
139CFLAGS += -dFORTIFY
140!endif
141
[106]142# for fm3res only
[907]143CFLAGSR = -bt=os2 -mf -bd -bm -olirs -s -j -we -wx -zfp -zgp -zp4 -zq
[21]144
[719]145!ifdef DEBUG
[691]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
[261]151!endif
[2]152
[691]153# rc Includes can be in current director or dll subdirectory
[903]154!if $(USE_RC)
155RCFLAGS = -r -i dll
156RCFLAGS2 = -x2
157!else
[691]158# Pass 1 flags
159RCFLAGS = -r -i=dll -ad
160# Pass 2 flags
[899]161RCFLAGS2 =
[691]162!endif
163
[261]164!ifndef MAKERES
[721]165.c.obj: .AUTODEPEND
[691]166 $(CC) $(CFLAGS) $*.c
[261]167!else
168 # !error "MAKERES mode"
169!endif
[21]170
[691]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 &
[907]175 dirs.obj dirsize.obj draglist.obj droplist.obj eas.obj errutil.obj &
[691]176 extract.obj filldir.obj filter.obj findrec.obj flesh.obj fm2cmd.obj &
[1005]177 fonts.obj fortify.obj fsopen.obj &
178 getnames.obj grep.obj grep2.obj info.obj inis.obj &
[691]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 &
[907]182 objwin.obj &
183 pathutil.obj &
184 presparm.obj printer.obj remap.obj rename.obj saveclip.obj &
[691]185 seeall.obj select.obj seticon.obj shadow.obj sortcnr.obj srchpath.obj &
[907]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 &
[691]189 valid.obj viewer.obj viewinf.obj walkem.obj winlist.obj worker.obj &
190 wrappers.obj
[2]191
[691]192ICONS = icons\*.ico ..\icons\*.ico icons\*.ptr
193
[261]194!ifndef MAKERES
195
[691]196all: &
197 $(BASE).dll &
198 $(BASERES).res &
199 $(BASERES).dll &
200 ipf\fm3.hlp &
201 internal\mkstr.exe &
[983]202 fm3res.str
[2]203
[983]204dllsyms: $(SYMS) .symbolic
205
[691]206$(BASE).dll $(BASE).lib: $(OBJS) $(BASE).def $(BASE).lrf
207 @echo $(LINK) @$(BASE).lrf @$(BASE).def
208 $(LINK) @$(BASE).lrf @$(BASE).def
[261]209 @rem type $(BASE).lrf
210 bldlevel $@
[2]211
[691]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
[2]220
[261]221!else
222
[454]223# MAKERES mode - build resources only
[261]224
[691]225all: chkexe &
226 $(BASERES).res &
227 $(BASERES).dll &
228 ipf\fm3.hlp &
[261]229 fm3res.str
230
231chkexe:
232 @echo Checking required EXEs
233 if not exist internal\mkstr.exe internal\mkstr.exe
[970]234!ifndef DEBUG
[261]235 lxlite -c:exehdr internal\mkstr.exe >nul
[970]236!else
237! ifeq DEBUG 0
238 lxlite -c:exehdr internal\mkstr.exe >nul
239! endif
240!endif
[261]241
242!endif
243
244# Update resources only
245
246res:
247 @echo Updating resources only
[720]248 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) MAKERES=1
[261]249
[2]250internal\mkstr.exe: internal\mkstr.c version.h fm3str.h
251 cd internal
[720]252 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT)
[2]253 cd..
254
[722]255$(BASERES).obj: $(BASERES).c .AUTODEPEND
[691]256 $(CC) $(CFLAGSR) $(BASERES).c
[2]257
[691]258$(BASERES).res: *.rc *.dlg fm3dll2.h fm3dlg.h $(ICONS)
259 $(RC) $(RCFLAGS) $*
[903]260!if $(USE_RC)
[691]261 ren $*.res $*.res
262!endif
[2]263
[261]264!ifndef MAKERES
265
[691]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
[899]269 $(RC) $(RCFLAGS2) $(BASERES).res $@
[261]270 bldlevel $@
[2]271
[691]272$(BASERES).lrf: $(__MAKEFILES__)
273 @%write $^@ $(LFLAGS)
274 @%append $^@ name $(BASERES)
275 @for %f in ($(BASERES).obj) do @%append $^@ file %f
276
[976]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
[261]291!else
292
[454]293# MAKERES mode - build resources only
294
[261]295$(BASERES).dll: $(BASERES).res
296 @if not exist $@ echo $@ missing
[970]297!ifndef DEBUG
[261]298 lxlite $@ /x+ /b-
299 lxlite $@ /c:minstub
[970]300!else
301! ifeq DEBUG 0
302 lxlite $@ /x+ /b-
303 lxlite $@ /c:minstub
304! endif
305!endif
[691]306 $(RC) $(RCFLAGS2) $(BASERES).res $@
[970]307!ifndef DEBUG
[261]308 lxlite $@ /x- /b-
[970]309!else
310! ifeq DEBUG 0
311 lxlite $@ /x- /b-
312! endif
313!endif
[261]314 bldlevel $@
315
[903]316!endif # MAKERES mode
[261]317
[903]318# For testing new code
319tmp.obj: tmp.c
320
[408]321$(BASERES).str: $(BASE).str fm3str.h version.h
[261]322 internal\mkstr
[691]323 # ren $(BASERES).str $(BASERES).str
[482]324 copy $(BASERES).str ..\ /v
[2]325
[691]326ipf: ipf\fm3.hlp .symbolic
327
[1003]328ipf\fm3.hlp: ipf\*.ipf ipf\bitmaps\*.bmp ipf\makefile
[261]329 cd ipf
[720]330 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) fm3.hlp
[261]331 cd..
[2]332
[467]333# Run for each dependent
[698]334lxlite: $(BASE).dll $(BASERES).dll .symbolic
335# !lxlite /x- /b- $?
[970]336!ifndef DEBUG
[698]337 @for %f in ($(BASE).dll $(BASERES).dll) do !lxlite /x- /b- %f
[970]338!else
339! ifeq DEBUG 0
340 @for %f in ($(BASE).dll $(BASERES).dll) do !lxlite /x- /b- %f
341! endif
342!endif
[310]343
[691]344cleanobj: .symbolic
[261]345 cd internal
[720]346 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) cleanobj
[261]347 cd..
[146]348 -del *.obj
349
[691]350clean: .symbolic
[261]351 cd internal
[720]352 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean
[525]353 cd ..\ipf
[720]354 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean
[261]355 cd..
[146]356 -del *.dll
357 -del *.lib
[808]358 -del *.lrf
[146]359 -del *.map
360 -del *.obj
361 -del *.res
362 -del fm3res.str
Note: See TracBrowser for help on using the repository browser.