source: trunk/makefile_pre.mk@ 1567

Last change on this file since 1567 was 1514, checked in by Steven Levine, 15 years ago

Rework makefiles dropping support for obsolete HIMEM setting

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