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