source: trunk/make/setup.mak@ 9165

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

Added new tools. Restructured tools. More options. Fixes.

File size: 11.6 KB
Line 
1# $Id: setup.mak,v 1.16 2002-08-29 10:01:40 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# -----------------------------------------------------------------------------
13# Assert that the file isn't included several times.
14# -----------------------------------------------------------------------------
15!ifdef MAKE_SETUP_INCLUDED
16! error Fatal error: You've included setup.mak before!!!
17!endif
18MAKE_SETUP_INCLUDED = YES
19
20
21# -----------------------------------------------------------------------------
22# Validate the build the requested environment setup.
23# -----------------------------------------------------------------------------
24
25SHT_TRGPLTFRM=
26!if "$(BUILD_PLATFORM)" == "OS2"
27SHT_TRGPLTFRM=os2
28!endif
29!if "$(BUILD_PLATFORM)" == "WIN32"
30SHT_TRGPLTFRM=win32
31!endif
32!if "$(SHT_TRGPLTFRM)" == ""
33! error Fatal error: Env.var BUILD_PLATFORM is either unspecified or incorrect. ($(BUILD_PLATFORM)) Valid values: OS2 and WIN32
34!endif
35
36
37SHT_BLDMD=
38!if "$(BUILD_MODE)" == "RELEASE"
39SHT_BLDMD=rel
40!endif
41!if "$(BUILD_MODE)" == "DEBUG"
42SHT_BLDMD=deb
43!endif
44!if "$(BUILD_MODE)" == "PROFILE"
45SHT_BLDMD=prf
46!endif
47!if "$(SHT_BLDMD)" == ""
48! error Fatal error: Env.var BUILD_MODE is either unspecified or incorrect. ($(BUILD_MODE)) Valid values: RELEASE, DEBUG and PROFILE
49!endif
50
51
52SHT_BLDENV=
53!if "$(BUILD_ENV)" == "VAC308"
54SHT_BLDENV=vac308
55!endif
56!if "$(BUILD_ENV)" == "VAC365"
57SHT_BLDENV=vac365
58!endif
59!if "$(BUILD_ENV)" == "VAC4"
60SHT_BLDENV=vac4
61!endif
62!if "$(BUILD_ENV)" == "EMX"
63SHT_BLDENV=emx
64!endif
65!if "$(BUILD_ENV)" == "MSCV6"
66SHT_BLDENV=mscv6
67!endif
68!if "$(BUILD_ENV)" == "MSCV6-16"
69SHT_BLDENV=mscv6-16
70!endif
71!if "$(BUILD_ENV)" == "WAT11C"
72SHT_BLDENV=wat11
73!endif
74!if "$(BUILD_ENV)" == "WAT11C-16"
75SHT_BLDENV=wat11-16
76!endif
77!if "$(SHT_BLDENV)" == ""
78! 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.
79!endif
80
81
82!ifdef BUILD_ENV_FORCE
83SHT_BLDENVFRC=
84!if "$(BUILD_ENV_FORCE)" == "VAC308"
85SHT_BLDENVFRC=vac308
86!endif
87!if "$(BUILD_ENV_FORCE)" == "VAC365"
88SHT_BLDENVFRC=vac365
89!endif
90!if "$(BUILD_ENV_FORCE)" == "VAC4"
91SHT_BLDENVFRC=vac4
92!endif
93!if "$(BUILD_ENV_FORCE)" == "EMX"
94SHT_BLDENVFRC=emx
95!endif
96!if "$(BUILD_ENV_FORCE)" == "MSCV6"
97SHT_BLDENVFRC=mscv6
98!endif
99!if "$(BUILD_ENV_FORCE)" == "MSCV6-16"
100SHT_BLDENVFRC=mscv6-16
101!endif
102!if "$(BUILD_ENV_FORCE)" == "WAT11C"
103SHT_BLDENVFRC=wat11
104!endif
105!if "$(BUILD_ENV_FORCE)" == "WAT11C-16"
106SHT_BLDENVFRC=wat11-16
107!endif
108!if "$(SHT_BLDENVFRC)" == ""
109! error Fatal error: Var BUILD_ENV_FORCE is incorrect. ($(BUILD_ENV_FORCE)) Valid values: VAC308, VAC365, VAC4, EMX, MSCV6-16, WAT11C and WAT11C-16.
110!endif
111!else
112BUILD_ENV_FORCE=$(BUILD_ENV)
113SHT_BLDENVFRC=$(SHT_BLDENV)
114!endif
115
116
117# -----------------------------------------------------------------------------
118# Directories
119# -----------------------------------------------------------------------------
120
121# current directory.
122PATH_CURRENT = $(MAKEDIR)
123# Where build system files are located. (like this file)
124PATH_MAKE = $(PATH_ROOT)\make
125# Where the bulid system and other tools are located
126PATH_TOOLS = $(PATH_ROOT)\tools\bin
127# Where platform-specific files are located. (like the .def files)
128PATH_DEF = .
129# Where the include files are located.
130PATH_INCLUDES = $(PATH_ROOT)\include\win;.;$(PATH_ROOT)\include
131# Where the temporary files goes.
132PATH_OBJ = $(PATH_ROOT)\obj\$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV:-=_)
133# Where the libraries goes.
134PATH_LIB = $(PATH_ROOT)\lib\$(BUILD_MODE)
135# Base directory of the published files.
136PATH_PUB = $(PATH_ROOT)\bin\$(BUILD_MODE)
137# Base directory of the unstripped published files. (release mode only)
138PATH_PUB_DEB = $(PATH_ROOT)\bin\$(BUILD_MODE).unstripped
139# Sub dir where the executable binaries goes.
140PATH_SUB_BIN = .
141# Sub dir where the dynamic link libraries goes.
142PATH_SUB_DLL = .
143# Sub dir where the drivers goes. (common for IFS and SYS.)
144PATH_SUB_SYS = .
145# Sub dir where the virtual dos drivers goes.
146PATH_SUB_VDD = .
147# Sub dir where the documentation goes.
148PATH_SUB_DOC = .
149# Sub dir where the helpfiles goes.
150PATH_SUB_HLP = .
151
152
153
154# Note: Makefiles are supposed to set the correct *RELATIVE* path to the
155# projects root. Using '\' slashes please. No trailing slash.
156#
157# Example:
158# PATH_ROOT= ..\..\..
159# Assert PATH_ROOT
160!if "$(PATH_ROOT)" == ""
161!error fatal error: PATH_ROOT empty or undefined.
162!endif
163
164#
165# A workaround for SlickEdits inability to find the buggy files..
166# This fixes the relative paths of includes.
167# Set the make line to:
168# '%v && cd %p && nmake PATH_ROOT_ABS=%rp. %n.obj -a'
169# (NB! Set the project directory to the root dir by creating the project there!)
170#
171!ifdef SLKRUNS
172! ifdef PATH_ROOT_ABS
173PATH_ROOT = $(PATH_ROOT_ABS)
174! endif
175!endif
176
177
178
179# -----------------------------------------------------------------------------
180# Common variables / Project variables
181# -----------------------------------------------------------------------------
182
183# The default definitions.
184!ifndef ODIN32_USERAPP
185BUILD_DEFINES = -D__WIN32OS2__ -DTCPV40HDRS -DCOMCTL32UNDOC -D__WINE__
186!else
187BUILD_DEFINES = -D__WIN32OS2__ #-DTCPV40HDRS -DCOMCTL32UNDOC -D__WINE__
188!endif
189BUILD_BLDLEVEL_FLAGS = -V^"^#define=ODIN32_VERSION,$(PATH_ROOT)\include\odinbuild.h^" \
190 -M^"^#define=ODIN32_BUILD_NR,$(PATH_ROOT)\include\odinbuild.h^"
191BUILD_PROJECT = Odin32
192
193# Project Specific definitions.
194!if "$(BUILD_MODE)" != "DEBUG"
195LIB_ODINCRT = $(PATH_LIB)\odincrt.$(EXT_LIB)
196!else
197LIB_ODINCRT = $(PATH_LIB)\odincrtd.$(EXT_LIB)
198!endif
199!ifndef CUSTOMBUILD
200OBJ_DLLENTRY = $(PATH_LIB)\dllentry.$(EXT_OBJ)
201!else
202OBJ_DLLENTRY =
203!endif
204
205# This is the process file to include at end of the makefile.
206MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.mak
207
208# -----------------------------------------------------------------------------
209# Build the environments variables
210# -----------------------------------------------------------------------------
211
212# In the makefiles you're allowed to use the BUILD_ENVS_PRE,
213# BUILD_ENV_FORCE, BUILD_ENVS_POST variables to make private changes to the
214# environment. These are combined with the two base ones as follows:
215# $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
216#
217# BUILD_ENV_FORCE is used for changing the base compiler. Do *NOT* use
218# BUILD_ENV for that! BUILD_ENV_FORCE isn't used directly but in the setup
219# string above, but ENV_ENVS from the setup.[w]xyz.mk setup file is used.
220#
221
222# These strings are passed on to the BuildEnv.cmd script to setup the correct
223# shell environment.
224# TODO Should these be overridable by setup.[w]xyz.mak ? (kso)
225BUILD_ENVS_BASE_POST = toolkit40
226BUILD_ENVS_BASE_POST_16 =
227BUILD_ENVS_BASE_PRE = buildsetup emx cvs
228BUILD_ENVS_BASE_PRE_16 = buildsetup emx cvs toolkit40 ddkbase
229
230
231# -----------------------------------------------------------------------------
232# Set forwarding flag.
233# If there is any change in the environment
234# OR the environment is uncertain (_BUILD_PROJECT not right) Then
235# Forward all target commands to the new shell environment we setup.
236#
237# (This have to be done early so the CC setup and it's like can check for
238# the flag. The rest of the forward stuff is at the bottom.)
239# -----------------------------------------------------------------------------
240!if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)" || "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)" || "$(BUILD_ENVS_PRE)" != "" || "$(BUILD_ENVS_POST)" != ""
241BUILD_FORWARDING = 1
242!else
243BUILD_FORWARDING = 0
244!endif
245
246
247# -----------------------------------------------------------------------------
248# Include the setup.
249# First the default common tools setup is included.
250# The the environment specific setup.
251# -----------------------------------------------------------------------------
252
253!include $(PATH_MAKE)\setup.tools.mk
254
255MAKE_INCLUDE_SETUP = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENV).mk
256!ifndef BUILD_QUIET
257! ifndef MAKEVER
258! if [$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)]
259! endif
260! else
261$(ECHO) Including platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP)$(CLRRST)
262! endif
263!endif
264!include $(MAKE_INCLUDE_SETUP)
265
266
267# -----------------------------------------------------------------------------
268# Verify the environment setups.
269# Uncomment this when configuring a new project.
270# When the setup is stable comment it out. (it's a waste of time!)
271# -----------------------------------------------------------------------------
272
273#
274#!ifndef ENV_NAME
275#!error No environment signature has been defined ($(NAME_COMPLETE))
276#!endif
277#
278#!ifndef MAKE_INCLUDE_SETUP
279#!error No setup to include has been determined (MAKE_INCLUDE_SETUP)
280#!endif
281#
282#!if "$(ENV_STATUS)" != "OK"
283#!error Environment $(ENV_NAME) does work yet (ENV_STATUS is not OK).
284#!endif
285#
286#!ifndef CC
287#!error Environment $(ENV_NAME) does not define variable (CC).
288#!endif
289#
290#!ifndef CC_FLAGS_EXE
291#!error Environment $(ENV_NAME) does not define variable (CC_FLAGS_EXE).
292#!endif
293#
294#!ifndef LINK
295#!error Environment $(ENV_NAME) does not define variable (LINK).
296#!endif
297#
298#!ifndef LINK_FLAGS_EXE
299#!error Environment $(ENV_NAME) does not define variable (LINK_FLAGS_EXE).
300#!endif
301#
302
303
304# -----------------------------------------------------------------------------
305# Forwarding processing.
306# -----------------------------------------------------------------------------
307!if $(BUILD_FORWARDING)
308
309MAKE_INCLUDE_PROCESS = $(PATH_MAKE)\process.forwarder.mak
310
311# Debug - find the reason for forwarding.
312#! if 0
313#! if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"
314#! if [echo debug - _BUILD_PROJECT: "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"]
315#! endif
316#! endif
317#! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
318#! if [echo debug - BUILD_ENV: "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"]
319#! endif
320#! endif
321#! if "$(BUILD_ENVS_PRE)" != ""
322#! if [echo debug - BUILD_ENVS_PRE: "$(BUILD_ENVS_PRE)" != ""]
323#! endif
324#! endif
325#! if "$(BUILD_ENVS_POST)" != ""
326#! if [echo debug - BUILD_ENVS_POST: "$(BUILD_ENVS_POST)" != ""]
327#! endif
328#! endif
329#! endif
330
331
332# set the secret _build_project env.var.
333# Note: This 'SET' operation doesn't allways work as designed.
334# Therefore we have a workaround in the forwarder statement which makes
335# sure that the internal variable is set. The problem seems to be to
336# create new environment variables.
337! if "$(_BUILD_PROJECT)" != "$(BUILD_PROJECT)"
338! if [SET _BUILD_PROJECT=$(BUILD_PROJECT)]
339! endif
340! endif
341
342# Compiler change or just environment change.
343! if "$(BUILD_ENV)" != "$(BUILD_ENV_FORCE)"
344MAKE_INCLUDE_SETUP_FORCE = $(PATH_MAKE)\setup.$(SHT_TRGPLTFRM)$(SHT_BLDMD)$(SHT_BLDENVFRC).mk
345! ifndef BUILD_QUIET
346! ifndef MAKEVER
347! if [$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)]
348! endif
349! else
350$(ECHO) Including forced platform setup file $(CLRFIL)$(MAKE_INCLUDE_SETUP_FORCE)$(CLRRST)
351! endif
352! endif
353! include $(MAKE_INCLUDE_SETUP_FORCE)
354! ifdef ENV_16BIT
355BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE_16) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST_16) $(BUILD_ENVS_POST)
356! else
357BUILD_ENVS_CHANGE = $(ENV_ENVS: =- )- $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS_FORCE) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
358! endif
359! else
360! ifdef ENV_16BIT
361BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE_16) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST_16) $(BUILD_ENVS_POST)
362! else
363BUILD_ENVS_CHANGE = $(BUILD_ENVS_BASE_PRE) $(BUILD_ENVS_PRE) $(ENV_ENVS) $(BUILD_ENVS_BASE_POST) $(BUILD_ENVS_POST)
364! endif
365! endif
366
367!endif # BUILD_FORWARDING
368
Note: See TracBrowser for help on using the repository browser.