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