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