source: trunk/makefile_pre.mk@ 1194

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

Optimize makefiles
Change from dllsyms to syms target for consistency
Avoid extra work for wmake -a dist
Pass FORTIFY options to subordinate makefiles

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