source: trunk/makefile_pre.mk@ 1890

Last change on this file since 1890 was 1890, checked in by Steven Levine, 6 years ago

Add PMPRINTF enable support to makefiles.
Correct PMPRINTF debug macro enables in sources.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1# makefile_pre.mk - common makefile prefix settings for all makefiles
2# $Id: makefile_pre.mk 1890 2020-01-30 06:39:42Z stevenhl $
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
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
27CC = wcc386
28LINK = wlink
29
30!ifndef USE_RC # if not defined on command line
31!ifdef %USE_RC # if defined in environment
32USE_RC = $(%USE_RC)
33!endif
34!endif
35
36!ifdef USE_RC
37RC = rc -n
38!else
39RC = wrc -q
40!endif
41
42# Keep this code in sync with dll\makefile
43!ifdef DEBUG # if defined on wmake command line
44DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
45!else
46!ifdef %DEBUG # if defined in environment
47DEBUG = $(%DEBUG) # use value from environment
48DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
49!endif
50!endif
51
52!ifdef %WARNALL # if defined in environment
53WARNALL = $(%WARNALL) # use value from environment
54!endif
55
56!ifdef FORTIFY # if defined on wmake command line
57FORTIFY_OPT = FORTIFY=$(FORTIFY) # set in case needed by sub-make
58!else
59!ifdef %FORTIFY # if defined in environment
60FORTIFY = $(%FORTIFY) # use value from environment
61FORTIFY_OPT = FORTIFY=$(FORTIFY) # set in case needed by sub-make
62!endif
63!endif
64
65!ifdef PMPRINTF # if defined on wmake command line
66PMPRINTF_OPT = PMPRINTF=$(PMPRINTF) # set in case needed by sub-make
67!else
68!ifdef %PMPRINTF # if defined in environment
69PMPRINTF = $(%PMPRINTF) # use value from environment
70PMPRINTF_OPT = PMPRINTF=$(PMPRINTF) # set in case needed by sub-make
71!endif
72!endif
73
74SYMS = $(BASE).sym # target for building SYM files
75
76# Some flags are order dependent - see OpenWatcom docs
77# -bc console app
78# -bd build target is a Dynamic Link Library (DLL) (see bd)
79# -bg gui app with WinMain entry point
80# -bm multithread libs
81# -bt=os2 target
82# -d2 full debug
83# -d3 full debug w/unref
84# -hd dwarf
85# -j signed char
86# -mf flat
87# -olinars optimze loops, inline, e(n)able fp recip, relax (a)lias, reordering, space
88# -s disable stack checks
89# -sg generate calls to grow the stack
90# -st touch stack through SS first
91# -we treat warnings as errors
92# -wx max warnings
93# -zfp disable fs use
94# -zgp disable gs use
95# -zp4 align 4
96# -zq quiet
97
98# -wx excludes these
99# See GenCOptions() in openwatcom\bld\cc\c\coptions.c
100# -wce130 possible loss of precision
101# -wcd=303 no reference to formal parameter
102# -wcd=307 obsolete non-prototype declarator
103# -wcd=308 unprototyped function called
104# -wcd=309 unprototyped function called indirectly
105
106# We always compile with debug info to avoid needing a full rebuild just to debug
107# 2015-08-14 SHL HLL debug testing
108# CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hc
109CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hd
110
111!ifdef WARNALL
112CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
113!else
114CFLAGS += -we
115!endif
116
117!ifdef FORTIFY
118CFLAGS += -dFORTIFY
119!endif
120
121!ifdef PMPRINTF
122CFLAGS += -dPMPRINTF
123!endif
124
125LFLAGS = sys os2v2_pm op quiet op verbose op cache op caseexact op map sort global
126!ifdef DEBUG
127CFLAGS += -d$DEBUG_OPT
128# 2015-08-14 SHL HLL debug testing
129# LFLAGS += debug hll all
130LFLAGS += debug dwarf all
131!endif
132
133# rc Includes can be in current director or dll subdirectory
134!ifdef USE_RC
135RCFLAGS = -r -i dll
136RCFLAGS2 = -x2
137!else
138# Pass 1 flags
139RCFLAGS = -r -i=dll -ad
140# Pass 2 flags
141RCFLAGS2 =-ad
142!endif
143
144.SUFFIXES:
145.SUFFIXES: .obj .c .res .rc .ipf .sym .map .xqs
146
147!ifdef USE_RC
148.rc.res:
149 @echo.
150 @echo Compiling resource: $*.rc
151 @echo.
152 $(RC) $(RCFLAGS) $*.rc
153 ren $*.res $*.res
154!else
155.rc.res: .AUTODEPEND
156 @echo.
157 @echo Compiling resource: $*.rc
158 @echo.
159 $(RC) $(RCFLAGS) $*.rc
160!endif
161
162.c.obj: .AUTODEPEND
163 $(CC) $(CFLAGS) $*.c
164
165# eof
Note: See TracBrowser for help on using the repository browser.