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
RevLine 
[237]1# makefile_pre.mk - common makefile prefix settings for all makefiles
2# $Id: makefile_pre.mk 1133 2008-08-30 04:27:29Z 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
[1133]15# 22 Jul 08 SHL Pass FORTIFY to subordinate makefiles
[481]16
[691]17CC = wcc386
18LINK = wlink
[9]19
[903]20!ifndef USE_RC # if not defined on command line
21!ifdef %USE_RC # if defined in environment
22USE_RC = $(%USE_RC)
[874]23!else
[903]24USE_RC = 0
[714]25!endif
[874]26!endif
[691]27
[903]28!if $(USE_RC)
29RC = rc
30!else
[691]31RC = wrc
[237]32!endif
[9]33
[719]34# Keep this code in sync with dll\makefile
[720]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
[719]41!endif
42!endif
43
[1023]44!ifdef %WARNALL # if defined in environment
45WARNALL = $(%WARNALL) # use value from environment
46!endif
47
[1133]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
[1023]54!endif
[1133]55!endif
[1023]56
[976]57SYMS = $(BASE).sym #set a target for building SYM files
58
[691]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
[907]74# -we treat warnings as errors
[691]75# -wx max warnings
76# -zfp disable fs use
77# -zgp disable gs use
78# -zp4 align 4
79# -zq quiet
[9]80
[1023]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
[1133]89# We always compile with debug info to avoid needing a full rebuild just to debug
[1023]90CFLAGS = -bt=os2 -mf -bm -d2 -olirs -s -j -wx -zfp -zgp -zp4 -zq -hd
[9]91
[1023]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
[691]102LFLAGS = sys os2v2_pm op quiet op verbose op cache op caseexact op map
[719]103!ifdef DEBUG
104LFLAGS += debug dwarf all
[691]105!endif
[9]106
[691]107# rc Includes can be in current director or dll subdirectory
[903]108!if $(USE_RC)
109RCFLAGS = -r -i dll
110RCFLAGS2 = -x2
111!else
[691]112# Pass 1 flags
113RCFLAGS = -r -i=dll -ad
114# Pass 2 flags
115RCFLAGS2 =-ad
116!endif
117
[9]118.SUFFIXES:
[976]119.SUFFIXES: .obj .c .res .rc .ipf .sym .map
[9]120
[903]121!if $(USE_RC)
[9]122.rc.res:
[691]123 $(RC) $(RCFLAGS) $*.rc
[481]124 ren $*.res $*.res
[903]125!else
126.rc.res: .AUTODEPEND
127 $(RC) $(RCFLAGS) $*.rc
[691]128!endif
[9]129
[691]130.c.obj: .AUTODEPEND
131 $(CC) $(CFLAGS) $*.c
[9]132
133# The end
Note: See TracBrowser for help on using the repository browser.