| 1 | # makefile_pre.mk - common makefile prefix settings for all makefiles | 
|---|
| 2 | # $Id: makefile_pre.mk 1439 2009-07-12 21:57:04Z gyoung $ | 
|---|
| 3 |  | 
|---|
| 4 | # 01 Sep 06 SHL Adjust .res case | 
|---|
| 5 | # 02 Jun 07 SHL Convert to OpenWatcom | 
|---|
| 6 | # 27 Jun 07 SHL Use same CFLAGS for all builds | 
|---|
| 7 | # 27 Jun 07 SHL Allow DEBUG set from command line or environment | 
|---|
| 8 | # 03 Jul 07 SHL Change DEBUG semantics to ifdef/ifndef | 
|---|
| 9 | # 04 Jul 07 SHL Pass DEBUG settings to sub-make | 
|---|
| 10 | # 22 Sep 07 SHL Switch to 4 byte packing (-zp4) | 
|---|
| 11 | # 26 Sep 07 SHL Support USE_WRC from environment | 
|---|
| 12 | # 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment | 
|---|
| 13 | # 23 Jan 08 JBS Add support for building SYM files (Ticket 226) | 
|---|
| 14 | # 27 May 08 SHL Add WARNALL and FORTIFY support | 
|---|
| 15 | # 22 Jul 08 SHL Pass FORTIFY to subordinate makefiles | 
|---|
| 16 | # 06 Oct 08 SHL Pass DEBUG in CFLAGS; clean up USE_RC usage | 
|---|
| 17 | # 18 Nov 08 JBS Ticket 297: Various build improvements/corrections | 
|---|
| 18 | # 12 Jul 09 GKY Allow FM/2 to load in high memory call exehdr /hi | 
|---|
| 19 |  | 
|---|
| 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 | 
|---|
| 26 | # HIMEM - build with changes to allow loading in high memory | 
|---|
| 27 |  | 
|---|
| 28 | CC = wcc386 | 
|---|
| 29 | LINK = wlink | 
|---|
| 30 |  | 
|---|
| 31 | !ifndef USE_RC                  # if not defined on command line | 
|---|
| 32 | !ifdef %USE_RC                  # if defined in environment | 
|---|
| 33 | USE_RC = $(%USE_RC) | 
|---|
| 34 | !endif | 
|---|
| 35 | !endif | 
|---|
| 36 |  | 
|---|
| 37 | !ifdef USE_RC | 
|---|
| 38 | RC = rc -n | 
|---|
| 39 | !else | 
|---|
| 40 | RC = wrc -q | 
|---|
| 41 | !endif | 
|---|
| 42 |  | 
|---|
| 43 | # Keep this code in sync with dll\makefile | 
|---|
| 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 | 
|---|
| 50 | !endif | 
|---|
| 51 | !endif | 
|---|
| 52 |  | 
|---|
| 53 | !ifdef %WARNALL                 # if defined in environment | 
|---|
| 54 | WARNALL = $(%WARNALL)           # use value from environment | 
|---|
| 55 | !endif | 
|---|
| 56 |  | 
|---|
| 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 | 
|---|
| 63 | !endif | 
|---|
| 64 | !endif | 
|---|
| 65 |  | 
|---|
| 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 |  | 
|---|
| 75 | SYMS = $(BASE).sym              #set a target for building SYM files | 
|---|
| 76 |  | 
|---|
| 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 | 
|---|
| 92 | # -we           treat warnings as errors | 
|---|
| 93 | # -wx           max warnings | 
|---|
| 94 | # -zfp          disable fs use | 
|---|
| 95 | # -zgp          disable gs use | 
|---|
| 96 | # -zp4          align 4 | 
|---|
| 97 | # -zq           quiet | 
|---|
| 98 |  | 
|---|
| 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 |  | 
|---|
| 107 | # We always compile with debug info to avoid needing a full rebuild just to debug | 
|---|
| 108 | CFLAGS = -bt=os2 -mf -bm -d2 -olirs   -s -j -wx -zfp -zgp -zp4 -zq -hd | 
|---|
| 109 |  | 
|---|
| 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 |  | 
|---|
| 120 | LFLAGS = sys os2v2_pm op quiet op verbose op cache op caseexact op map | 
|---|
| 121 | !ifdef DEBUG | 
|---|
| 122 | CFLAGS += -d$DEBUG_OPT | 
|---|
| 123 | LFLAGS += debug dwarf all | 
|---|
| 124 | !endif | 
|---|
| 125 |  | 
|---|
| 126 | # rc Includes can be in current director or dll subdirectory | 
|---|
| 127 | !ifdef USE_RC | 
|---|
| 128 | RCFLAGS = -r -i dll | 
|---|
| 129 | RCFLAGS2 = -x2 | 
|---|
| 130 | !else | 
|---|
| 131 | # Pass 1 flags | 
|---|
| 132 | RCFLAGS = -r -i=dll -ad | 
|---|
| 133 | # Pass 2 flags | 
|---|
| 134 | RCFLAGS2 =-ad | 
|---|
| 135 | !endif | 
|---|
| 136 |  | 
|---|
| 137 | .SUFFIXES: | 
|---|
| 138 | .SUFFIXES: .obj .c .res .rc .ipf .sym .map | 
|---|
| 139 |  | 
|---|
| 140 | !ifdef USE_RC | 
|---|
| 141 | .rc.res: | 
|---|
| 142 | @echo. | 
|---|
| 143 | @echo Compiling resource: $*.rc | 
|---|
| 144 | @echo. | 
|---|
| 145 | $(RC) $(RCFLAGS) $*.rc | 
|---|
| 146 | ren $*.res $*.res | 
|---|
| 147 | !else | 
|---|
| 148 | .rc.res: .AUTODEPEND | 
|---|
| 149 | @echo. | 
|---|
| 150 | @echo Compiling resource: $*.rc | 
|---|
| 151 | @echo. | 
|---|
| 152 | $(RC) $(RCFLAGS) $*.rc | 
|---|
| 153 | !endif | 
|---|
| 154 |  | 
|---|
| 155 | .c.obj: .AUTODEPEND | 
|---|
| 156 | $(CC) $(CFLAGS) $*.c | 
|---|
| 157 |  | 
|---|
| 158 | # The end | 
|---|