source: trunk/makefile_pre.mk@ 1567

Last change on this file since 1567 was 1514, checked in by Steven Levine, 15 years ago

Rework makefiles dropping support for obsolete HIMEM setting

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