source: trunk/makefile_pre.mk@ 1092

Last change on this file since 1092 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
RevLine 
[237]1# makefile_pre.mk - common makefile prefix settings for all makefiles
2# $Id: makefile_pre.mk 1023 2008-05-28 02:14:53Z stevenhl $
[9]3
[481]4# 01 Sep 06 SHL Adjust .res case
[691]5# 02 Jun 07 SHL Convert to OpenWatcom
[714]6# 27 Jun 07 SHL Use same CFLAGS for all builds
[719]7# 27 Jun 07 SHL Allow DEBUG set from command line or environment
8# 03 Jul 07 SHL Change DEBUG semantics to ifdef/ifndef
[720]9# 04 Jul 07 SHL Pass DEBUG settings to sub-make
[842]10# 22 Sep 07 SHL Switch to 4 byte packing (-zp4)
[874]11# 26 Sep 07 SHL Support USE_WRC from environment
[903]12# 03 Jan 08 SHL Switch to wrc.exe default; support USE_RC from environment
[976]13# 23 Jan 08 JBS Add support for building SYM files (Ticket 226)
[1023]14# 27 May 08 SHL Add WARNALL and FORTIFY support
[481]15
[691]16CC = wcc386
17LINK = wlink
[9]18
[903]19!ifndef USE_RC # if not defined on command line
20!ifdef %USE_RC # if defined in environment
21USE_RC = $(%USE_RC)
[874]22!else
[903]23USE_RC = 0
[714]24!endif
[874]25!endif
[691]26
[903]27!if $(USE_RC)
28RC = rc
29!else
[691]30RC = wrc
[237]31!endif
[9]32
[719]33# Keep this code in sync with dll\makefile
[720]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
[719]40!endif
41!endif
42
[1023]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
[976]51SYMS = $(BASE).sym #set a target for building SYM files
52
[691]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
[907]68# -we treat warnings as errors
[691]69# -wx max warnings
70# -zfp disable fs use
71# -zgp disable gs use
72# -zp4 align 4
73# -zq quiet
[9]74
[1023]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
[714]83# We always compile with debug info to avoid needed a full rebuild just to debug
[1023]84CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hd
[9]85
[1023]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
[691]96LFLAGS = sys os2v2_pm op quiet op verbose op cache op caseexact op map
[719]97!ifdef DEBUG
98LFLAGS += debug dwarf all
[691]99!endif
[9]100
[691]101# rc Includes can be in current director or dll subdirectory
[903]102!if $(USE_RC)
103RCFLAGS = -r -i dll
104RCFLAGS2 = -x2
105!else
[691]106# Pass 1 flags
107RCFLAGS = -r -i=dll -ad
108# Pass 2 flags
109RCFLAGS2 =-ad
110!endif
111
[9]112.SUFFIXES:
[976]113.SUFFIXES: .obj .c .res .rc .ipf .sym .map
[9]114
[903]115!if $(USE_RC)
[9]116.rc.res:
[691]117 $(RC) $(RCFLAGS) $*.rc
[481]118 ren $*.res $*.res
[903]119!else
120.rc.res: .AUTODEPEND
121 $(RC) $(RCFLAGS) $*.rc
[691]122!endif
[9]123
[691]124.c.obj: .AUTODEPEND
125 $(CC) $(CFLAGS) $*.c
[9]126
127# The end
Note: See TracBrowser for help on using the repository browser.