| 1 | # makefile_pre.mk - common makefile prefix settings for all makefiles
 | 
|---|
| 2 | # $Id: makefile_pre.mk 1897 2022-08-14 19:14:53Z gyoung $
 | 
|---|
| 3 | 
 | 
|---|
| 4 | # Copyright (c) 1993-98 M. Kimes
 | 
|---|
| 5 | # Copyright (c) 2002-2020 Steven H. Levine
 | 
|---|
| 6 | 
 | 
|---|
| 7 | # 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment
 | 
|---|
| 8 | # 23 Jan 08 JBS Add support for building SYM files (Ticket 226)
 | 
|---|
| 9 | # 27 May 08 SHL Add WARNALL and FORTIFY support
 | 
|---|
| 10 | # 22 Jul 08 SHL Pass FORTIFY to subordinate makefiles
 | 
|---|
| 11 | # 06 Oct 08 SHL Pass DEBUG in CFLAGS; clean up USE_RC usage
 | 
|---|
| 12 | # 18 Nov 08 JBS Ticket 297: Various build improvements/corrections
 | 
|---|
| 13 | # 13 Apr 10 SHL Drop HIMEM support
 | 
|---|
| 14 | # 21 Jun 11 GKY Add exceptq .xqs support
 | 
|---|
| 15 | # 07 Jan 11 SHL sort map
 | 
|---|
| 16 | # 25 Jan 12 SHL Comments
 | 
|---|
| 17 | # 14 Aug 15 SHL Test hll debug - FIXME to be gone
 | 
|---|
| 18 | # 25 Jan 20 SHL Add PMPRINTF support - PMPRINTF_OPT CFLAGS
 | 
|---|
| 19 | # 06 Aug 22 GKY Add FM4_NOWARN_DSPACE 
 | 
|---|
| 20 | 
 | 
|---|
| 21 | # Environment: see dll\makefile
 | 
|---|
| 22 | 
 | 
|---|
| 23 | # DEBUG - not defined = release build, defined = debug build
 | 
|---|
| 24 | # WARNALL - add more warnings if defined
 | 
|---|
| 25 | # FORTIFY - build with FORTIFYed memory
 | 
|---|
| 26 | # USE_RC - build with rc.exe if defined, other build with wrc.exe
 | 
|---|
| 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 PMPRINTF                         # if defined on wmake command line
 | 
|---|
| 67 | PMPRINTF_OPT = PMPRINTF=$(PMPRINTF)     # set in case needed by sub-make
 | 
|---|
| 68 | !else
 | 
|---|
| 69 | !ifdef %PMPRINTF                        # if defined in environment
 | 
|---|
| 70 | PMPRINTF = $(%PMPRINTF)                 # use value from environment
 | 
|---|
| 71 | PMPRINTF_OPT = PMPRINTF=$(PMPRINTF)     # set in case needed by sub-make
 | 
|---|
| 72 | !endif
 | 
|---|
| 73 | !endif
 | 
|---|
| 74 | 
 | 
|---|
| 75 | !ifdef FM4_NOWARN_DSPACE                                        # if defined on wmake command line
 | 
|---|
| 76 | FM4_NOWARN_DSPACE_OPT = FM4_NOWARN_DSPACE=$(FM4_NOWARN_DSPACE)  # set in case needed by sub-make
 | 
|---|
| 77 | !else
 | 
|---|
| 78 | !ifdef %FM4_NOWARN_DSPACE
 | 
|---|
| 79 | FM4_NOWARN_DSPACE = $(%FM4_NOWARN_DSPACE)                       # use value from environment
 | 
|---|
| 80 | FM4_NOWARN_DSPACE_OPT = FM4_NOWARN_DSPACE=$(FM4_NOWARN_DSPACE)  # set in case needed by sub-make
 | 
|---|
| 81 | !endif
 | 
|---|
| 82 | !endif
 | 
|---|
| 83 | 
 | 
|---|
| 84 | SYMS = $(BASE).sym                      # target for building SYM files
 | 
|---|
| 85 | 
 | 
|---|
| 86 | # Some flags are order dependent - see OpenWatcom docs
 | 
|---|
| 87 | # -bc           console app
 | 
|---|
| 88 | # -bd           build target is a Dynamic Link Library (DLL) (see bd)
 | 
|---|
| 89 | # -bg           gui app with WinMain entry point
 | 
|---|
| 90 | # -bm           multithread libs
 | 
|---|
| 91 | # -bt=os2       target
 | 
|---|
| 92 | # -d2           full debug
 | 
|---|
| 93 | # -d3           full debug w/unref
 | 
|---|
| 94 | # -hd           dwarf
 | 
|---|
| 95 | # -j            signed char
 | 
|---|
| 96 | # -mf           flat
 | 
|---|
| 97 | # -olinars      optimze loops, inline, e(n)able fp recip, relax (a)lias, reordering, space
 | 
|---|
| 98 | # -s            disable stack checks
 | 
|---|
| 99 | # -sg           generate calls to grow the stack
 | 
|---|
| 100 | # -st           touch stack through SS first
 | 
|---|
| 101 | # -we           treat warnings as errors
 | 
|---|
| 102 | # -wx           max warnings
 | 
|---|
| 103 | # -zfp          disable fs use
 | 
|---|
| 104 | # -zgp          disable gs use
 | 
|---|
| 105 | # -zp4          align 4
 | 
|---|
| 106 | # -zq           quiet
 | 
|---|
| 107 | 
 | 
|---|
| 108 | # -wx excludes these
 | 
|---|
| 109 | # See GenCOptions() in openwatcom\bld\cc\c\coptions.c
 | 
|---|
| 110 | # -wce130       possible loss of precision
 | 
|---|
| 111 | # -wcd=303      no reference to formal parameter
 | 
|---|
| 112 | # -wcd=307      obsolete non-prototype declarator
 | 
|---|
| 113 | # -wcd=308      unprototyped function called
 | 
|---|
| 114 | # -wcd=309      unprototyped function called indirectly
 | 
|---|
| 115 | 
 | 
|---|
| 116 | # We always compile with debug info to avoid needing a full rebuild just to debug
 | 
|---|
| 117 | # 2015-08-14 SHL HLL debug testing
 | 
|---|
| 118 | # CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hc
 | 
|---|
| 119 | CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hd
 | 
|---|
| 120 | 
 | 
|---|
| 121 | !ifdef WARNALL
 | 
|---|
| 122 | CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
 | 
|---|
| 123 | !else
 | 
|---|
| 124 | CFLAGS += -we
 | 
|---|
| 125 | !endif
 | 
|---|
| 126 | 
 | 
|---|
| 127 | !ifdef FORTIFY
 | 
|---|
| 128 | CFLAGS += -dFORTIFY
 | 
|---|
| 129 | !endif
 | 
|---|
| 130 | 
 | 
|---|
| 131 | !ifdef PMPRINTF
 | 
|---|
| 132 | CFLAGS += -dPMPRINTF
 | 
|---|
| 133 | !endif
 | 
|---|
| 134 | 
 | 
|---|
| 135 | LFLAGS = sys os2v2_pm op quiet op verbose op cache op caseexact op map sort global
 | 
|---|
| 136 | !ifdef DEBUG
 | 
|---|
| 137 | CFLAGS += -d$DEBUG_OPT
 | 
|---|
| 138 | # 2015-08-14 SHL HLL debug testing
 | 
|---|
| 139 | # LFLAGS += debug hll all
 | 
|---|
| 140 | LFLAGS += debug dwarf all
 | 
|---|
| 141 | !endif
 | 
|---|
| 142 | 
 | 
|---|
| 143 | # rc Includes can be in current director or dll subdirectory
 | 
|---|
| 144 | !ifdef USE_RC
 | 
|---|
| 145 | RCFLAGS = -r -i dll
 | 
|---|
| 146 | RCFLAGS2 = -x2
 | 
|---|
| 147 | !else
 | 
|---|
| 148 | # Pass 1 flags
 | 
|---|
| 149 | RCFLAGS = -r -i=dll -ad
 | 
|---|
| 150 | # Pass 2 flags
 | 
|---|
| 151 | RCFLAGS2 =-ad
 | 
|---|
| 152 | !endif
 | 
|---|
| 153 | 
 | 
|---|
| 154 | .SUFFIXES:
 | 
|---|
| 155 | .SUFFIXES: .obj .c .res .rc .ipf .sym .map .xqs
 | 
|---|
| 156 | 
 | 
|---|
| 157 | !ifdef USE_RC
 | 
|---|
| 158 | .rc.res:
 | 
|---|
| 159 |    @echo.
 | 
|---|
| 160 |    @echo Compiling resource: $*.rc
 | 
|---|
| 161 |    @echo.
 | 
|---|
| 162 |    $(RC) $(RCFLAGS) $*.rc
 | 
|---|
| 163 |    ren $*.res $*.res
 | 
|---|
| 164 | !else
 | 
|---|
| 165 | .rc.res: .AUTODEPEND
 | 
|---|
| 166 |    @echo.
 | 
|---|
| 167 |    @echo Compiling resource: $*.rc
 | 
|---|
| 168 |    @echo.
 | 
|---|
| 169 |   $(RC) $(RCFLAGS) $*.rc
 | 
|---|
| 170 | !endif
 | 
|---|
| 171 | 
 | 
|---|
| 172 | .c.obj: .AUTODEPEND
 | 
|---|
| 173 |   $(CC) $(CFLAGS) $*.c
 | 
|---|
| 174 | 
 | 
|---|
| 175 | # eof
 | 
|---|