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
RevLine 
[237]1# makefile_pre.mk - common makefile prefix settings for all makefiles
2# $Id: makefile_pre.mk 1890 2020-01-30 06:39:42Z stevenhl $
[9]3
[1514]4# Copyright (c) 1993-98 M. Kimes
[1890]5# Copyright (c) 2002-2020 Steven H. Levine
[1514]6
[903]7# 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment
[976]8# 23 Jan 08 JBS Add support for building SYM files (Ticket 226)
[1023]9# 27 May 08 SHL Add WARNALL and FORTIFY support
[1133]10# 22 Jul 08 SHL Pass FORTIFY to subordinate makefiles
[1259]11# 06 Oct 08 SHL Pass DEBUG in CFLAGS; clean up USE_RC usage
[1281]12# 18 Nov 08 JBS Ticket 297: Various build improvements/corrections
[1514]13# 13 Apr 10 SHL Drop HIMEM support
[1576]14# 21 Jun 11 GKY Add exceptq .xqs support
[1661]15# 07 Jan 11 SHL sort map
16# 25 Jan 12 SHL Comments
[1890]17# 14 Aug 15 SHL Test hll debug - FIXME to be gone
18# 25 Jan 20 SHL Add PMPRINTF support - PMPRINTF_OPT CFLAGS
[481]19
[1259]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
[691]27CC = wcc386
28LINK = wlink
[9]29
[903]30!ifndef USE_RC # if not defined on command line
31!ifdef %USE_RC # if defined in environment
32USE_RC = $(%USE_RC)
[714]33!endif
[874]34!endif
[691]35
[1259]36!ifdef USE_RC
[1281]37RC = rc -n
[903]38!else
[1281]39RC = wrc -q
[237]40!endif
[9]41
[719]42# Keep this code in sync with dll\makefile
[1661]43!ifdef DEBUG # if defined on wmake command line
[720]44DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
45!else
[1661]46!ifdef %DEBUG # if defined in environment
47DEBUG = $(%DEBUG) # use value from environment
[720]48DEBUG_OPT = DEBUG=$(DEBUG) # set in case needed by sub-make
[719]49!endif
50!endif
51
[1023]52!ifdef %WARNALL # if defined in environment
53WARNALL = $(%WARNALL) # use value from environment
54!endif
55
[1133]56!ifdef FORTIFY # if defined on wmake command line
57FORTIFY_OPT = FORTIFY=$(FORTIFY) # set in case needed by sub-make
58!else
[1661]59!ifdef %FORTIFY # if defined in environment
60FORTIFY = $(%FORTIFY) # use value from environment
[1133]61FORTIFY_OPT = FORTIFY=$(FORTIFY) # set in case needed by sub-make
[1023]62!endif
[1133]63!endif
[1023]64
[1890]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
[1661]74SYMS = $(BASE).sym # target for building SYM files
[976]75
[691]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
[907]91# -we treat warnings as errors
[691]92# -wx max warnings
93# -zfp disable fs use
94# -zgp disable gs use
95# -zp4 align 4
96# -zq quiet
[9]97
[1023]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
[1133]106# We always compile with debug info to avoid needing a full rebuild just to debug
[1890]107# 2015-08-14 SHL HLL debug testing
108# CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hc
[1661]109CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hd
[9]110
[1023]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
[1890]121!ifdef PMPRINTF
122CFLAGS += -dPMPRINTF
123!endif
124
[1613]125LFLAGS = sys os2v2_pm op quiet op verbose op cache op caseexact op map sort global
[719]126!ifdef DEBUG
[1259]127CFLAGS += -d$DEBUG_OPT
[1890]128# 2015-08-14 SHL HLL debug testing
129# LFLAGS += debug hll all
[719]130LFLAGS += debug dwarf all
[691]131!endif
[9]132
[691]133# rc Includes can be in current director or dll subdirectory
[1259]134!ifdef USE_RC
[903]135RCFLAGS = -r -i dll
136RCFLAGS2 = -x2
137!else
[691]138# Pass 1 flags
139RCFLAGS = -r -i=dll -ad
140# Pass 2 flags
141RCFLAGS2 =-ad
142!endif
143
[9]144.SUFFIXES:
[1576]145.SUFFIXES: .obj .c .res .rc .ipf .sym .map .xqs
[9]146
[1259]147!ifdef USE_RC
[9]148.rc.res:
[1282]149 @echo.
150 @echo Compiling resource: $*.rc
151 @echo.
[691]152 $(RC) $(RCFLAGS) $*.rc
[481]153 ren $*.res $*.res
[903]154!else
155.rc.res: .AUTODEPEND
[1282]156 @echo.
157 @echo Compiling resource: $*.rc
158 @echo.
[903]159 $(RC) $(RCFLAGS) $*.rc
[691]160!endif
[9]161
[691]162.c.obj: .AUTODEPEND
163 $(CC) $(CFLAGS) $*.c
[9]164
[1890]165# eof
Note: See TracBrowser for help on using the repository browser.