source: trunk/makefile_pre.mk@ 1268

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

Rework makefile dependencies to avoid target dependent build failures.
Drop support for DEBUG=0 - it does not match what our C code expects.

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