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