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