source: trunk/make/setup.mak@ 9047

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

BUILD_FORWARDING flag. Found problem when _BUILD_PROJECT isn't yet set.

File size: 10.2 KB
Line 
1# $Id: setup.mak,v 1.11 2002-08-20 07:05:24 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)" == "MSCV6-16"
64SHT_BLDENV=mscv6-16
65!endif
66!if "$(BUILD_ENV)" == "WAT11C"
67SHT_BLDENV=wat11
68!endif
69!if "$(BUILD_ENV)" == "WAT11C-16"
70SHT_BLDENV=wat11-16
71!endif
72!if "$(SHT_BLDENV)" == ""
73! error Fatal error: Env.var BUILD_ENV is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6-16, WAT11C and WAT11C-16.
74!endif
75
76
77!ifdef BUILD_ENV_FORCE
78SHT_BLDENVFRC=
79!if "$(BUILD_ENV_FORCE)" == "VAC308"
80SHT_BLDENVFRC=vac308
81!endif
82!if "$(BUILD_ENV_FORCE)" == "VAC365"
83SHT_BLDENVFRC=vac365
84!endif
85!if "$(BUILD_ENV_FORCE)" == "VAC4"
86SHT_BLDENVFRC=vac4
87!endif
88!if "$(BUILD_ENV_FORCE)" == "EMX"
89SHT_BLDENVFRC=emx
90!endif
91!if "$(BUILD_ENV_FORCE)" == "MSCV6"
92SHT_BLDENVFRC=mscv6
93!endif
94!if "$(BUILD_ENV_FORCE)" == "MSCV6-16"
95SHT_BLDENVFRC=mscv6-16
96!endif
97!if "$(BUILD_ENV_FORCE)" == "WAT11C"
98SHT_BLDENVFRC=wat11
99!endif
100!if "$(BUILD_ENV_FORCE)" == "WAT11C-16"
101SHT_BLDENVFRC=wat11-16
102!endif
103!if "$(SHT_BLDENVFRC)" == ""
104! error Fatal error: Var BUILD_ENV_FORCE is incorrect. ($(BUILD_ENV_FORCE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6-16, WAT11C and WAT11C-16.
105!endif
106!else
107BUILD_ENV_FORCE=$(BUILD_ENV)
108SHT_BLDENVFRC=$(SHT_BLDENV)
109!endif
110
111
112# -----------------------------------------------------------------------------
113# Directories
114# -----------------------------------------------------------------------------
115
116# current directory.
117PATH_CURRENT = $(MAKEDIR)
118# Where build system files are located. (like this file)
119PATH_MAKE = $(PATH_ROOT)\make
120# Where the bulid system and other tools are located
121PATH_TOOLS = $(PATH_ROOT)\tools\bin
122# Where platform-specific files are located. (like the .def files)
123# (default) PATH_DEF = $(SHT_TRGPLTFRM)
124PATH_DEF = .
125# Where the include files are located.
126PATH_INCLUDES = $(PATH_ROOT)\include;$(PATH_ROOT)\include\win
127
128# Where the temporary files goes.
129PATH_OBJ = $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV)
130# Where the executable binaries goes.
131PATH_BIN = $(PATH_ROOT)\bin\$(BUILD_MODE)
132# Where the public libraries goes.
133PATH_LIB = $(PATH_ROOT)\lib\$(BUILD_MODE)
134# Where the dynamic link libraries goes.
135PATH_DLL = $(PATH_ROOT)\bin\$(BUILD_MODE)
136# Where the drivers goes. (common for IFS and SYS.)
137PATH_SYS = $(PATH_ROOT)\bin\$(BUILD_MODE)
138# Where the virtual dos drivers goes.
139PATH_VDD = $(PATH_ROOT)\bin\$(BUILD_MODE)
140# Where the documentation goes.
141PATH_DOC = $(PATH_ROOT)\bin\$(BUILD_MODE)
142# Where the helpfiles goes.
143PATH_HLP = $(PATH_ROOT)\bin\$(BUILD_MODE)
144
145
146# Note: Makefiles are supposed to set the correct *RELATIVE* path to the
147# projects root. Using '\' slashes please. No trailing slash.
148#
149# Example:
150# PATH_ROOT= ..\..\..
151# Assert PATH_ROOT
152!if "$(PATH_ROOT)" == ""
153!error fatal error: PATH_ROOT empty or undefined.
154!endif
155
156#
157# A workaround for SlickEdits inability to find the buggy files..
158# This fixes the relative paths of includes.
159# Set the make line to:
160# '%v && cd %p && nmake PATH_ROOT_ABS=%rp. %n.obj -a'
161# (NB! Set the project directory to the root dir by creating the project there!)
162#
163!ifdef SLKRUNS
164! ifdef PATH_ROOT_ABS
165PATH_ROOT = $(PATH_ROOT_ABS)
166! endif
167!endif
168
169
170
171# -----------------------------------------------------------------------------
172# Common variables / Project variables
173# -----------------------------------------------------------------------------
174
175# The default definitions.
176BUILD_DEFINES = -D__WIN32OS2__ -D__WINE__
177BUILD_BLDLEVEL_FLAGS = -V^"^#define=ODIN32_VERSION,$(PATH_ROOT)\include\odinbuild.h^" \
178 -M^"^#define=ODIN32_BUILD_NR,$(PATH_ROOT)\include\odinbuild.h^"
179BUILD_PROJECT = Odin32
180
181# This is the process file to include at end of the makefile.
182MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.mak
183
184
185
186# -----------------------------------------------------------------------------
187# Include the setup.
188# First the default common tools setup is included.
189# The the environment specific setup.
190# -----------------------------------------------------------------------------
191
192!include $(PATH_MAKE)\setup.tools.mk
193
194MAKE_INCLUDE_SETUP = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV).mk
195!ifndef BUILD_QUIET
196! ifndef MAKEVER
197! if [$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)]
198! endif
199! else
200$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)
201! endif
202!endif
203!include $(MAKE_INCLUDE_SETUP)
204
205
206# -----------------------------------------------------------------------------
207# Verify the environment setups.
208# -----------------------------------------------------------------------------
209
210!ifndef ENV_NAME
211!error No environment signature has been defined ($(NAME_COMPLETE))
212!endif
213
214!ifndef MAKE_INCLUDE_SETUP
215!error No setup to include has been determined (MAKE_INCLUDE_SETUP)
216!endif
217
218!if "$(ENV_STATUS)" != "OK"
219!error Environment $(ENV_NAME) does work yet (ENV_STATUS is not OK).
220!endif
221
222!ifndef CC
223!error Environment $(ENV_NAME) does not define variable (CC).
224!endif
225
226!ifndef CC_FLAGS_EXE
227!error Environment $(ENV_NAME) does not define variable (CC_FLAGS_EXE).
228!endif
229
230!ifndef LINK
231!error Environment $(ENV_NAME) does not define variable (LINK).
232!endif
233
234!ifndef LINK_FLAGS_EXE
235!error Environment $(ENV_NAME) does not define variable (LINK_FLAGS_EXE).
236!endif
237
238
239# -----------------------------------------------------------------------------
240# Build the environments
241# -----------------------------------------------------------------------------
242
243# In the makefiles you're allowed to use the BUILD_ENVS_PRE,
244# BUILD_ENV_FORCE, BUILD_ENVS_POST variables to make private changes to the
245# environment. These are combined with the two base ones as follows:
246# $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
247#
248# BUILD_ENV_FORCE is used for changing the base compiler. Do *NOT* use
249# BUILD_ENV for that! BUILD_ENV_FORCE isn't used directly but in the setup
250# string above, but ENV_ENVS from the setup.[w]xyz.mk setup file is used.
251#
252
253# These strings are passed on to the BuildEnv.cmd script to setup the correct
254# shell environment.
255# TODO Should these be overridable by setup.[w]xyz.mak ? (kso)
256
257BUILD_ENVS_BASE_POST = toolkit40
258BUILD_ENVS_BASE_POST_16 =
259BUILD_ENVS_BASE_PRE = buildsetup emx cvs
260BUILD_ENVS_BASE_PRE_16 = buildsetup emx cvs toolkit40 ddkbase
261
262
263# Check if there is any change in the environment OR if the environment is
264# uncertain (_BUILD_PROJECT not right).
265# If there are Then we will have to forward all target commands to the
266# correct shell environment
267!if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)" || "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)" || "$(BUILD_ENVS_PRE)" != "" || "$(BUILD_ENVS_POST)" != ""
268MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.forwarder.mak
269
270# Debug - find the reason for forwarding.
271#! if 0
272#! if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"
273#! if [echo debug - _BUILD_PROJECT: "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"]
274#! endif
275#! endif
276#! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
277#! if [echo debug - BUILD_ENV: "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"]
278#! endif
279#! endif
280#! if "$(BUILD_ENVS_PRE)" != ""
281#! if [echo debug - BUILD_ENVS_PRE: "$(BUILD_ENVS_PRE)" != ""]
282#! endif
283#! endif
284#! if "$(BUILD_ENVS_POST)" != ""
285#! if [echo debug - BUILD_ENVS_POST: "$(BUILD_ENVS_POST)" != ""]
286#! endif
287#! endif
288#! endif
289
290# flag that we're forwarding.
291BUILD_FORWARDING = 1
292
293# set the secret _build_project env.var.
294# Note: This 'SET' operation doesn't allways work as designed.
295# Therefore we have a workaround in the forwarder statement which makes
296# sure that the internal variable is set. The problem seems to be to
297# create new environment variables.
298! if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"
299! if [SET _BUILD_PROJECT=$(BUILD_PROJECT)]
300! endif
301! endif
302
303# Compiler change or just environment change.
304! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
305MAKE_INCLUDE_SETUP_FORCE = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENVFRC).mk
306! ifndef BUILD_QUIET
307! ifndef MAKEVER
308! if [$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)]
309! endif
310! else
311$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)
312! endif
313! endif
314! include $(MAKE_INCLUDE_SETUP_FORCE)
315! ifdef ENV_16BIT
316BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE_16) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST_16) $(BUILD_ENVS_POST)
317! else
318BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
319! endif
320! else
321! ifdef ENV_16BIT
322BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE_16) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST_16) $(BUILD_ENVS_POST)
323! else
324BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
325! endif
326! endif
327
328!else
329# Flag that we're not forwarding
330BUILD_FORWARDING = 0
331!endif
332
333
334!endif # MAKE_SETUP_INCLUDED
Note: See TracBrowser for help on using the repository browser.