source: trunk/make/setup.mak@ 10493

Last change on this file since 10493 was 10493, checked in by bird, 22 years ago

InnoTek GCC.

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