source: trunk/make/setup.mak@ 8294

Last change on this file since 8294 was 8294, checked in by bird, 23 years ago

Support for forced environment change, using BUILD_ENV_FORCE,
BUILD_ENVS_PRE and BUILD_ENVS_POST.
(first successful try)

File size: 8.0 KB
Line 
1# $Id: setup.mak,v 1.5 2002-04-22 01:59:33 bird Exp $
2
3#
4# Generic makefile system.
5#
6# Setting up the build environment variables
7#
8# Many of the variables are a subject to change from project to project.
9#
10
11
12!ifndef MAKE_SETUP_INCLUDED
13MAKE_SETUP_INCLUDED=YES
14
15
16# -----------------------------------------------------------------------------
17# Validate the build the requested environment setup.
18# -----------------------------------------------------------------------------
19
20SHT_TRGPLTFRM=
21!if "$(BUILD_PLATFORM)" == "OS2"
22SHT_TRGPLTFRM=os2
23!endif
24!if "$(BUILD_PLATFORM)" == "WIN32"
25SHT_TRGPLTFRM=win32
26!endif
27!if "$(SHT_TRGPLTFRM)" == ""
28! error Fatal error: Env.var BUILD_PLATFORM is either unspecified or incorrect. ($(BUILD_PLATFORM)) Valid values: OS2 and WIN32
29!endif
30
31
32SHT_BLDMD=
33!if "$(BUILD_MODE)" == "RELEASE"
34SHT_BLDMD=rel
35!endif
36!if "$(BUILD_MODE)" == "DEBUG"
37SHT_BLDMD=deb
38!endif
39!if "$(BUILD_MODE)" == "PROFILE"
40SHT_BLDMD=prf
41!endif
42!if "$(SHT_BLDMD)" == ""
43! error Fatal error: Env.var BUILD_MODE is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: RELEASE, DEBUG and PROFILE
44!endif
45
46
47SHT_BLDENV=
48!if "$(BUILD_ENV)" == "VAC308"
49SHT_BLDENV=vac308
50!endif
51!if "$(BUILD_ENV)" == "VAC365"
52SHT_BLDENV=vac365
53!endif
54!if "$(BUILD_ENV)" == "VAC4"
55SHT_BLDENV=vac4
56!endif
57!if "$(BUILD_ENV)" == "EMX"
58SHT_BLDENV=emx
59!endif
60!if "$(BUILD_ENV)" == "MSCV6"
61SHT_BLDENV=mscv6
62!endif
63!if "$(BUILD_ENV)" == "WAT11C"
64SHT_BLDENV=wat11
65!endif
66!if "$(SHT_BLDENV)" == ""
67! error Fatal error: Env.var BUILD_ENV is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6 and WATCOM
68!endif
69
70
71!ifdef BUILD_ENV_FORCE
72SHT_BLDENVFRC=
73!if "$(BUILD_ENV_FORCE)" == "VAC308"
74SHT_BLDENVFRC=vac308
75!endif
76!if "$(BUILD_ENV_FORCE)" == "VAC365"
77SHT_BLDENVFRC=vac365
78!endif
79!if "$(BUILD_ENV_FORCE)" == "VAC4"
80SHT_BLDENVFRC=vac4
81!endif
82!if "$(BUILD_ENV_FORCE)" == "EMX"
83SHT_BLDENVFRC=emx
84!endif
85!if "$(BUILD_ENV_FORCE)" == "MSCV6"
86SHT_BLDENVFRC=mscv6
87!endif
88!if "$(BUILD_ENV_FORCE)" == "WAT11C"
89SHT_BLDENVFRC=wat11
90!endif
91!if "$(SHT_BLDENVFRC)" == ""
92! error Fatal error: Var BUILD_ENV_FORCE is incorrect. ($(BUILD_ENV_FORCE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6 and WATCOM
93!endif
94!else
95BUILD_ENV_FORCE=$(BUILD_ENV)
96SHT_BLDENVFRC=$(SHT_BLDENV)
97!endif
98
99
100# -----------------------------------------------------------------------------
101# Directories
102# -----------------------------------------------------------------------------
103
104# current directory.
105PATH_CURRENT = $(MAKEDIR)
106# Where build system files are located. (like this file)
107PATH_MAKE = $(PATH_ROOT)\make
108# Where the bulid system and other tools are located
109PATH_TOOLS = $(PATH_ROOT)\tools\bin
110# Where platform-specific files are located. (like the .def files)
111# (default) PATH_DEF = $(SHT_TRGPLTFRM)
112PATH_DEF = .
113# Where the include files are located.
114PATH_INCLUDES = $(PATH_ROOT)\include;$(PATH_ROOT)\include\win
115
116# Where the temporary files goes.
117PATH_OBJ = $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV)
118# Where the executable binaries goes.
119PATH_BIN = $(PATH_ROOT)\bin\$(BUILD_MODE)
120# Where the public libraries goes.
121PATH_LIB = $(PATH_ROOT)\lib\$(BUILD_MODE)
122# Where the dynamic link libraries goes.
123PATH_DLL = $(PATH_ROOT)\bin\$(BUILD_MODE)
124# Where the drivers goes. (common for IFS and SYS.)
125PATH_SYS = $(PATH_ROOT)\bin\$(BUILD_MODE)
126# Where the virtual dos drivers goes.
127PATH_VDD = $(PATH_ROOT)\bin\$(BUILD_MODE)
128# Where the documentation goes.
129PATH_DOC = $(PATH_ROOT)\bin\$(BUILD_MODE)
130# Where the helpfiles goes.
131PATH_HLP = $(PATH_ROOT)\bin\$(BUILD_MODE)
132
133
134# Note: Makefiles are supposed to set the correct *RELATIVE* path to the
135# projects root. Using '\' slashes please. No trailing slash.
136#
137# Example:
138# PATH_ROOT= ..\..\..
139# Assert PATH_ROOT
140!if "$(PATH_ROOT)" == ""
141!error fatal error: PATH_ROOT empty or undefined.
142!endif
143
144
145# -----------------------------------------------------------------------------
146# Common variables / Project variables
147# -----------------------------------------------------------------------------
148
149# The default definitions.
150BUILD_DEFINES = -D__WIN32OS2__ -D__WINE__ -D__i386__
151
152# This is the process file to include at end of the makefile.
153MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.mak
154
155
156
157# -----------------------------------------------------------------------------
158# Include the setup.
159# First the default common tools setup is included.
160# The the environment specific setup.
161# -----------------------------------------------------------------------------
162
163!include $(PATH_MAKE)\setup.tools.mk
164
165MAKE_INCLUDE_SETUP = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV).mk
166!ifndef BUILD_QUIET
167! if [$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)]
168! endif
169!endif
170!include $(MAKE_INCLUDE_SETUP)
171
172
173# -----------------------------------------------------------------------------
174# Verify the environment setups.
175# -----------------------------------------------------------------------------
176
177!ifndef ENV_NAME
178!error No environment signature has been defined ($(NAME_COMPLETE))
179!endif
180
181!ifndef MAKE_INCLUDE_SETUP
182!error No setup to include has been determined (MAKE_INCLUDE_SETUP)
183!endif
184
185!if "$(ENV_STATUS)" != "OK"
186!error Environment $(ENV_NAME) does work yet (ENV_STATUS is not OK).
187!endif
188
189!ifndef CC
190!error Environment $(ENV_NAME) does not define variable (CC).
191!endif
192
193!ifndef CC_FLAGS_EXE
194!error Environment $(ENV_NAME) does not define variable (CC_FLAGS_EXE).
195!endif
196
197!ifndef LINK
198!error Environment $(ENV_NAME) does not define variable (LINK).
199!endif
200
201!ifndef LINK_FLAGS_EXE
202!error Environment $(ENV_NAME) does not define variable (LINK_FLAGS_EXE).
203!endif
204
205
206# -----------------------------------------------------------------------------
207# Ensure the output path exists
208# -----------------------------------------------------------------------------
209!if "$(PATH_OBJ)" != ""
210! if [$(TOOL_EXISTS) $(PATH_OBJ)] != 0
211! ifndef BUILD_QUIET
212! if [$(ECHO) Target path $(PATH_OBJ) does NOT exist. Creating. $(CLRRST)]
213! endif
214! endif
215! if [$(TOOL_CREATEPATH) $(PATH_OBJ)]
216! error Fatal error: Could not create $(PATH_OBJ).
217! endif
218! endif
219!endif
220
221
222
223# -----------------------------------------------------------------------------
224# Build the environments
225# -----------------------------------------------------------------------------
226
227# In the makefiles you're allowed to use the BUILD_ENVS_PRE,
228# BUILD_ENV_FORCE, BUILD_ENVS_POST variables to make private changes to the
229# environment. These are combined with the two base ones as follows:
230# $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
231#
232# BUILD_ENV_FORCE is used for changing the base compiler. Do *NOT* use
233# BUILD_ENV for that! BUILD_ENV_FORCE isn't used directly but in the setup
234# string above, but ENV_ENVS from the setup.[w]xyz.mk setup file is used.
235#
236
237# These strings are passed on to the BuildEnv.cmd script to setup the correct
238# shell environment.
239# TODO Should these be overridable by setup.[w]xyz.mak ? (kso)
240
241BUILD_ENVS_BASE_POST = toolkit40
242BUILD_ENVS_BASE_PRE =
243
244
245# Check if there is any change in the environment.
246# If there are we will have to forward all target commands to the
247# correct shell environment
248!if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)" || "$(BUILD_ENVS_PRE)" != "" || "$(BUILD_ENVS_POST)" != ""
249MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.forwarder.mak
250
251
252# Compiler change or just environment change.
253! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
254MAKE_INCLUDE_SETUP_FORCE = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENVFRC).mk
255! ifndef BUILD_QUIET
256! if [$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)]
257! endif
258! endif
259! include $(MAKE_INCLUDE_SETUP_FORCE)
260BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
261! else
262BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
263! endif
264
265!endif
266
267
268!endif # MAKE_SETUP_INCLUDED
269
Note: See TracBrowser for help on using the repository browser.