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