source: trunk/makefile_pre.mk@ 1330

Last change on this file since 1330 was 1282, checked in by John Small, 17 years ago

Ticket 297: Eliminate multiple commands per line.

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