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
RevLine 
[72]1# dll\makefile - build fm/2 dlls, help files, string tables and resource kit
[62]2# $Id: makefile 1514 2010-04-13 20:55:04Z stevenhl $
[21]3
[415]4# Copyright (c) 1993-98 M. Kimes
[1394]5# Copyright (c) 2002, 2009 Steven H. Levine
[415]6
[134]7# 22 May 03 SHL Correct icon dependencies
[673]8# 12 May 07 SHL Drop obsolete macros
[691]9# 02 Jun 07 SHL Convert to OpenWatcom
[719]10# 27 Jun 07 SHL Allow DEBUG set from command line or environment
11# 03 Jul 07 SHL Change DEBUG semantics to ifdef/ifndef
[720]12# 04 Jul 07 SHL Pass DEBUG settings to sub-make
[1133]13# 04 Jul 07 SHL Add missing .autodepend
[808]14# 06 Aug 07 SHL Tweak CFLAGS for DEBUG builds
15# 26 Aug 07 SHL Clean *.lrf
[833]16# 05 Sep 07 SHL Correct USE_WRC logic
[841]17# 22 Sep 07 SHL Switch to 4 byte packing (-zp4)
[899]18# 03 Jan 08 SHL Prepare for final, implending switch to wrc.exe
[903]19# 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment
[907]20# 05 Jan 08 SHL Sync with .c renames
[973]21# 22 Feb 08 JBS Suppress lxlite processing when DEBUG=1
[1003]22# 01 Mar 08 SHL Add missing dependencies. Add WARNALL support
[1005]23# 05 May 08 SHL Add FORTIFY support
[1022]24# 26 May 08 SHL Update WARNALL to warn about more
[1133]25# 22 Jul 08 SHL Change from dllsyms to syms target for consistency
[1242]26# 06 Oct 08 SHL Add missing -dDEBUG= to CFLAGS; rework lxlite suppress logic
[1335]27# 25 Oct 08 SHL Rework dependencies to avoid target dependent build failures
[1281]28# 18 Nov 08 JBS Ticket 297: Various build improvements/corrections
[1285]29# 19 Nov 08 JBS Ticket 297: Removed bldlevel calls
[1289]30# 21 Nov 08 JBS Ticket 297: Added support for copyright.c and copyright.h
[1322]31# 08 Dec 08 SHL Ticket 307: Add process dump support
[1331]32# 10 Dec 08 SHL Ticket 26: Add exception handler and exceptq support
[1394]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
[1439]36# 12 Jul 09 GKY Allow FM/2 to load in high memory call exehdr /hi
[1468]37# 30 Jul 09 SHL Avoid attempting to attach resources to fm3res.map
[1514]38# 13 Apr 10 SHL Drop HIMEM support
[62]39
[1331]40# Environment: see makefile_pre.mk
[72]41
[1468]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
[72]46
[691]47BASE = fm3dll
48BASERES = fm3res
[2]49
[691]50.SUFFIXES:
51.SUFFIXES: .obj .c .res .rc .ipf
[2]52
[691]53CC = wcc386
54LINK = wlink
55
[903]56!ifndef USE_RC # if not defined on command line
57!ifdef %USE_RC # if defined in environment
58USE_RC = $(%USE_RC)
[719]59!endif
[833]60!endif
[691]61
[1335]62!ifdef USE_RC
[1281]63RC = rc -n
[903]64!else
[1281]65RC = wrc -q
[261]66!endif
[2]67
[719]68# Keep this code in sync with makefile_pre.mk
[808]69!ifdef DEBUG # if defined on wmake command line
[720]70DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
71!else
[808]72!ifdef %DEBUG # if defined in environment
73DEBUG = $(%DEBUG) # use value from environment
[720]74DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
[719]75!endif
76!endif
77
[1003]78!ifdef %WARNALL # if defined in environment
79WARNALL = $(%WARNALL) # use value from environment
80!endif
81
[1005]82!ifdef %FORTIFY # if defined in environment
83FORTIFY = $(%FORTIFY) # use value from environment
84!endif
85
[1394]86SYMS = $(BASE).sym $(BASERES).sym # targets for building SYM files
[976]87
[691]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
[808]94# -d1 line number debugging information
[734]95# -d2 full symbolic debugging information
[691]96# -d3 full debug w/unref
97# -hd dwarf
98# -j signed char
99# -mf flat
[808]100# -of generate traceable stack frames
[691]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
[907]105# -we treat warnings as errors
[691]106# -wx max warnings
107# -zfp disable fs use
108# -zgp disable gs use
109# -zp4 align 4
110# -zq quiet
[261]111
[1022]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
[719]120!ifdef DEBUG
[1242]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
[691]123!else
[1022]124CFLAGS = -bt=os2 -mf -bd -bm -hd -d1 -olirs -s -sg -j -wx -zfp -zgp -zp4 -zq
[261]125!endif
[220]126
[1022]127# 26 May 08 SHL Was reversed
[1003]128!ifdef WARNALL
[1022]129CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
130!else
131CFLAGS += -we
[1003]132!endif
133
[1005]134!ifdef FORTIFY
135CFLAGS += -dFORTIFY
136!endif
137
[106]138# for fm3res only
[907]139CFLAGSR = -bt=os2 -mf -bd -bm -olirs -s -j -we -wx -zfp -zgp -zp4 -zq
[21]140
[719]141!ifdef DEBUG
[691]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
[261]147!endif
[2]148
[691]149# rc Includes can be in current director or dll subdirectory
[1335]150!ifdef USE_RC
[903]151RCFLAGS = -r -i dll
152RCFLAGS2 = -x2
153!else
[691]154# Pass 1 flags
155RCFLAGS = -r -i=dll -ad
156# Pass 2 flags
[899]157RCFLAGS2 =
[691]158!endif
159
[261]160!ifndef MAKERES
[1133]161.c.obj: .autodepend
[691]162 $(CC) $(CFLAGS) $*.c
[261]163!else
164 # !error "MAKERES mode"
165!endif
[21]166
[691]167OBJS = arccnrs.obj archive.obj assoc.obj attribs.obj autoview.obj &
168 avl.obj avv.obj chklist.obj cmdline.obj codepage.obj &
[1399]169 collect.obj colors.obj command.obj common.obj &
[1394]170 comp.obj copyf.obj &
[1335]171 datamin.obj defview.obj delims.obj dircnrs.obj &
[1322]172 dirs.obj dirsize.obj draglist.obj droplist.obj dumputil.obj &
[1331]173 eas.obj errutil.obj excputil.obj extract.obj &
174 filldir.obj filter.obj findrec.obj flesh.obj fm2cmd.obj &
[1403]175 fonts.obj fortify.obj &
[1399]176 getnames.obj grep.obj grep2.obj i18nutil.obj info.obj inis.obj &
[691]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 &
[907]180 objwin.obj &
181 pathutil.obj &
182 presparm.obj printer.obj remap.obj rename.obj saveclip.obj &
[691]183 seeall.obj select.obj seticon.obj shadow.obj sortcnr.obj srchpath.obj &
[907]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 &
[691]187 valid.obj viewer.obj viewinf.obj walkem.obj winlist.obj worker.obj &
188 wrappers.obj
[2]189
[691]190ICONS = icons\*.ico ..\icons\*.ico icons\*.ptr
191
[261]192!ifndef MAKERES
193
[691]194all: &
195 $(BASE).dll &
196 $(BASERES).res &
197 $(BASERES).dll &
[1394]198 ipf\fm3.hlp
[1439]199
[1133]200syms: $(SYMS) .symbolic
[983]201
[1394]202$(BASE).dll $(BASE).lib $(BASE).map: $(OBJS) $(BASE).def $(BASE).lrf
[1415]203 @echo Linking $(BASE).dll
[691]204 $(LINK) @$(BASE).lrf @$(BASE).def
[261]205 @rem type $(BASE).lrf
[2]206
[691]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
[2]212
[1335]213!else # MAKERES defined
[261]214
[454]215# MAKERES mode - build resources only
[261]216
[1335]217all: $(BASERES).res &
[691]218 $(BASERES).dll &
[1394]219 ipf\fm3.hlp
[261]220
[1335]221!endif # MAKERES
[261]222
223# Update resources only
224
225res:
226 @echo Updating resources only
[720]227 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) MAKERES=1
[261]228
[1133]229$(BASERES).obj: $(BASERES).c .autodepend
[691]230 $(CC) $(CFLAGSR) $(BASERES).c
[2]231
[1289]232$(BASERES).res: *.rc *.dlg fm3dll2.h fm3dlg.h copyright.h $(ICONS)
[1282]233 @echo.
234 @echo Compiling resource: $*
235 @echo.
[691]236 $(RC) $(RCFLAGS) $*
[1335]237!ifdef USE_RC
[691]238 ren $*.res $*.res
239!endif
[2]240
[261]241!ifndef MAKERES
242
[1335]243$(BASERES).dll $(BASERES).lib $(BASERES).map: $(BASERES).res $(BASERES).obj $(BASERES).def $(BASERES).lrf
[1415]244 @echo Linking $(BASERES).dll
[691]245 $(LINK) @$(BASERES).lrf @$(BASERES).def
[1282]246 @echo.
[1468]247 @echo Attaching resources to $(BASERES).dll
[1282]248 @echo.
[1468]249 $(RC) $(RCFLAGS2) $(BASERES).res $(BASERES).dll
[2]250
[691]251$(BASERES).lrf: $(__MAKEFILES__)
252 @%write $^@ $(LFLAGS)
253 @%append $^@ name $(BASERES)
254 @for %f in ($(BASERES).obj) do @%append $^@ file %f
255
[976]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
[1335]264!else # MAKERES defined
[261]265
[454]266# MAKERES mode - build resources only
267
[261]268$(BASERES).dll: $(BASERES).res
269 @if not exist $@ echo $@ missing
[970]270!ifndef DEBUG
[261]271 lxlite $@ /x+ /b-
272 lxlite $@ /c:minstub
[970]273!endif
[1282]274 @echo.
[1468]275 @echo Ataching resources to $@
[1282]276 @echo.
[691]277 $(RC) $(RCFLAGS2) $(BASERES).res $@
[970]278!ifndef DEBUG
[261]279 lxlite $@ /x- /b-
[970]280!endif
[261]281
[1335]282!endif # MAKERES
283
[903]284# For testing new code
285tmp.obj: tmp.c
286
[691]287ipf: ipf\fm3.hlp .symbolic
288
[1003]289ipf\fm3.hlp: ipf\*.ipf ipf\bitmaps\*.bmp ipf\makefile
[261]290 cd ipf
[720]291 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) fm3.hlp
[261]292 cd..
[2]293
[467]294# Run for each dependent
[698]295lxlite: $(BASE).dll $(BASERES).dll .symbolic
296# !lxlite /x- /b- $?
[970]297!ifndef DEBUG
[1335]298 @for %f in ($(BASE).dll $(BASERES).dll) do !lxlite /x- /b- %f
[970]299!endif
[310]300
[1439]301# Run for each dependent
302loadhigh: $(BASE).dll $(BASERES).dll .symbolic
303 @for %f in ($(BASE).dll $(BASERES).dll) do !exehdr /hi %f
304
[691]305cleanobj: .symbolic
[146]306 -del *.obj
307
[691]308clean: .symbolic
[1394]309 cd ipf
[720]310 $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean
[261]311 cd..
[146]312 -del *.dll
313 -del *.lib
[808]314 -del *.lrf
[146]315 -del *.map
316 -del *.obj
317 -del *.res
[1054]318 -del *.sym
Note: See TracBrowser for help on using the repository browser.