source: trunk/makefile_pre.mk@ 1268

Last change on this file since 1268 was 1259, checked in by Steven Levine, 17 years ago

Rework makefile dependencies to avoid target dependent build failures.
Drop support for DEBUG=0 - it does not match what our C code expects.

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