[237] | 1 | # makefile_pre.mk - common makefile prefix settings for all makefiles
|
---|
| 2 | # $Id: makefile_pre.mk 1661 2012-01-26 00:00:12Z stevenhl $
|
---|
[9] | 3 |
|
---|
[1514] | 4 | # Copyright (c) 1993-98 M. Kimes
|
---|
[1661] | 5 | # Copyright (c) 2002, 2012 Steven H. Levine
|
---|
[1514] | 6 |
|
---|
[903] | 7 | # 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment
|
---|
[976] | 8 | # 23 Jan 08 JBS Add support for building SYM files (Ticket 226)
|
---|
[1023] | 9 | # 27 May 08 SHL Add WARNALL and FORTIFY support
|
---|
[1133] | 10 | # 22 Jul 08 SHL Pass FORTIFY to subordinate makefiles
|
---|
[1259] | 11 | # 06 Oct 08 SHL Pass DEBUG in CFLAGS; clean up USE_RC usage
|
---|
[1281] | 12 | # 18 Nov 08 JBS Ticket 297: Various build improvements/corrections
|
---|
[1514] | 13 | # 13 Apr 10 SHL Drop HIMEM support
|
---|
[1576] | 14 | # 21 Jun 11 GKY Add exceptq .xqs support
|
---|
[1661] | 15 | # 07 Jan 11 SHL sort map
|
---|
| 16 | # 25 Jan 12 SHL Comments
|
---|
[481] | 17 |
|
---|
[1259] | 18 | # Environment: see dll\makefile
|
---|
| 19 |
|
---|
| 20 | # DEBUG - not defined = release build, defined = debug build
|
---|
| 21 | # WARNALL - add more warnings if defined
|
---|
| 22 | # FORTIFY - build with FORTIFYed memory
|
---|
| 23 | # USE_RC - build with rc.exe if defined, other build with wrc.exe
|
---|
| 24 |
|
---|
[691] | 25 | CC = wcc386
|
---|
| 26 | LINK = wlink
|
---|
[9] | 27 |
|
---|
[903] | 28 | !ifndef USE_RC # if not defined on command line
|
---|
| 29 | !ifdef %USE_RC # if defined in environment
|
---|
| 30 | USE_RC = $(%USE_RC)
|
---|
[714] | 31 | !endif
|
---|
[874] | 32 | !endif
|
---|
[691] | 33 |
|
---|
[1259] | 34 | !ifdef USE_RC
|
---|
[1281] | 35 | RC = rc -n
|
---|
[903] | 36 | !else
|
---|
[1281] | 37 | RC = wrc -q
|
---|
[237] | 38 | !endif
|
---|
[9] | 39 |
|
---|
[719] | 40 | # Keep this code in sync with dll\makefile
|
---|
[1661] | 41 | !ifdef DEBUG # if defined on wmake command line
|
---|
[720] | 42 | DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
|
---|
| 43 | !else
|
---|
[1661] | 44 | !ifdef %DEBUG # if defined in environment
|
---|
| 45 | DEBUG = $(%DEBUG) # use value from environment
|
---|
[720] | 46 | DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
|
---|
[719] | 47 | !endif
|
---|
| 48 | !endif
|
---|
| 49 |
|
---|
[1023] | 50 | !ifdef %WARNALL # if defined in environment
|
---|
| 51 | WARNALL = $(%WARNALL) # use value from environment
|
---|
| 52 | !endif
|
---|
| 53 |
|
---|
[1133] | 54 | !ifdef FORTIFY # if defined on wmake command line
|
---|
| 55 | FORTIFY_OPT = FORTIFY=$(FORTIFY) # set in case needed by sub-make
|
---|
| 56 | !else
|
---|
[1661] | 57 | !ifdef %FORTIFY # if defined in environment
|
---|
| 58 | FORTIFY = $(%FORTIFY) # use value from environment
|
---|
[1133] | 59 | FORTIFY_OPT = FORTIFY=$(FORTIFY) # set in case needed by sub-make
|
---|
[1023] | 60 | !endif
|
---|
[1133] | 61 | !endif
|
---|
[1023] | 62 |
|
---|
[1661] | 63 | SYMS = $(BASE).sym # target for building SYM files
|
---|
[976] | 64 |
|
---|
[691] | 65 | # Some flags are order dependent - see OpenWatcom docs
|
---|
| 66 | # -bc console app
|
---|
| 67 | # -bd build target is a Dynamic Link Library (DLL) (see bd)
|
---|
| 68 | # -bg gui app with WinMain entry point
|
---|
| 69 | # -bm multithread libs
|
---|
| 70 | # -bt=os2 target
|
---|
| 71 | # -d2 full debug
|
---|
| 72 | # -d3 full debug w/unref
|
---|
| 73 | # -hd dwarf
|
---|
| 74 | # -j signed char
|
---|
| 75 | # -mf flat
|
---|
| 76 | # -olinars optimze loops, inline, e(n)able fp recip, relax (a)lias, reordering, space
|
---|
| 77 | # -s disable stack checks
|
---|
| 78 | # -sg generate calls to grow the stack
|
---|
| 79 | # -st touch stack through SS first
|
---|
[907] | 80 | # -we treat warnings as errors
|
---|
[691] | 81 | # -wx max warnings
|
---|
| 82 | # -zfp disable fs use
|
---|
| 83 | # -zgp disable gs use
|
---|
| 84 | # -zp4 align 4
|
---|
| 85 | # -zq quiet
|
---|
[9] | 86 |
|
---|
[1023] | 87 | # -wx excludes these
|
---|
| 88 | # See GenCOptions() in openwatcom\bld\cc\c\coptions.c
|
---|
| 89 | # -wce130 possible loss of precision
|
---|
| 90 | # -wcd=303 no reference to formal parameter
|
---|
| 91 | # -wcd=307 obsolete non-prototype declarator
|
---|
| 92 | # -wcd=308 unprototyped function called
|
---|
| 93 | # -wcd=309 unprototyped function called indirectly
|
---|
| 94 |
|
---|
[1133] | 95 | # We always compile with debug info to avoid needing a full rebuild just to debug
|
---|
[1661] | 96 | CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hd
|
---|
[9] | 97 |
|
---|
[1023] | 98 | !ifdef WARNALL
|
---|
| 99 | CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
|
---|
| 100 | !else
|
---|
| 101 | CFLAGS += -we
|
---|
| 102 | !endif
|
---|
| 103 |
|
---|
| 104 | !ifdef FORTIFY
|
---|
| 105 | CFLAGS += -dFORTIFY
|
---|
| 106 | !endif
|
---|
| 107 |
|
---|
[1613] | 108 | LFLAGS = sys os2v2_pm op quiet op verbose op cache op caseexact op map sort global
|
---|
[719] | 109 | !ifdef DEBUG
|
---|
[1259] | 110 | CFLAGS += -d$DEBUG_OPT
|
---|
[719] | 111 | LFLAGS += debug dwarf all
|
---|
[691] | 112 | !endif
|
---|
[9] | 113 |
|
---|
[691] | 114 | # rc Includes can be in current director or dll subdirectory
|
---|
[1259] | 115 | !ifdef USE_RC
|
---|
[903] | 116 | RCFLAGS = -r -i dll
|
---|
| 117 | RCFLAGS2 = -x2
|
---|
| 118 | !else
|
---|
[691] | 119 | # Pass 1 flags
|
---|
| 120 | RCFLAGS = -r -i=dll -ad
|
---|
| 121 | # Pass 2 flags
|
---|
| 122 | RCFLAGS2 =-ad
|
---|
| 123 | !endif
|
---|
| 124 |
|
---|
[9] | 125 | .SUFFIXES:
|
---|
[1576] | 126 | .SUFFIXES: .obj .c .res .rc .ipf .sym .map .xqs
|
---|
[9] | 127 |
|
---|
[1259] | 128 | !ifdef USE_RC
|
---|
[9] | 129 | .rc.res:
|
---|
[1282] | 130 | @echo.
|
---|
| 131 | @echo Compiling resource: $*.rc
|
---|
| 132 | @echo.
|
---|
[691] | 133 | $(RC) $(RCFLAGS) $*.rc
|
---|
[481] | 134 | ren $*.res $*.res
|
---|
[903] | 135 | !else
|
---|
| 136 | .rc.res: .AUTODEPEND
|
---|
[1282] | 137 | @echo.
|
---|
| 138 | @echo Compiling resource: $*.rc
|
---|
| 139 | @echo.
|
---|
[903] | 140 | $(RC) $(RCFLAGS) $*.rc
|
---|
[691] | 141 | !endif
|
---|
[9] | 142 |
|
---|
[691] | 143 | .c.obj: .AUTODEPEND
|
---|
| 144 | $(CC) $(CFLAGS) $*.c
|
---|
[9] | 145 |
|
---|
| 146 | # The end
|
---|