source: trunk/makefile_pre.mk@ 1036

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

Add WARNALL and FORTIFY support

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