| 1 | # $Id: process.forwarder.mak,v 1.4 2002-06-19 02:16:08 bird Exp $
|
|---|
| 2 |
|
|---|
| 3 | #
|
|---|
| 4 | # Generic makefile system.
|
|---|
| 5 | #
|
|---|
| 6 | # The common build process rules for the case
|
|---|
| 7 | # where we forward to a different compiler environment.
|
|---|
| 8 | #
|
|---|
| 9 | # Note: this makefile is supposed to be included from the
|
|---|
| 10 | # current source path.
|
|---|
| 11 | #
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | # -----------------------------------------------------------------------------
|
|---|
| 15 | # Assertions.
|
|---|
| 16 | # This makefile expects setup.mak and the specific setup to be included
|
|---|
| 17 | # already.
|
|---|
| 18 | # It also requires the TARGET_NAME to be specified in the makefile.
|
|---|
| 19 | # -----------------------------------------------------------------------------
|
|---|
| 20 | !if "$(MAKE_SETUP_INCLUDED)" != "YES"
|
|---|
| 21 | !error Fatal error: You must include setup.mak before process.mak in the makefile.
|
|---|
| 22 | !endif
|
|---|
| 23 | !if "$(ENV_STATUS)" != "OK"
|
|---|
| 24 | !error Fatal error: The environment is not valid. Bad setup.mak?
|
|---|
| 25 | !endif
|
|---|
| 26 |
|
|---|
| 27 | !if "$(TARGET_NAME)" == "" && "$(TARGET_MODE)" != "EMPTY"
|
|---|
| 28 | !error Fatal error: TARGET_NAME is not defined! Should be set in the makefile.
|
|---|
| 29 | !endif
|
|---|
| 30 |
|
|---|
| 31 | # -----------------------------------------------------------------------------
|
|---|
| 32 | # Set necessary defaults.
|
|---|
| 33 | # -----------------------------------------------------------------------------
|
|---|
| 34 |
|
|---|
| 35 | # just make it shut up for now.
|
|---|
| 36 | TARGET = process.forwarder.mak
|
|---|
| 37 |
|
|---|
| 38 | # Default makefile names.
|
|---|
| 39 | !ifndef BUILD_MAKEFILE
|
|---|
| 40 | BUILD_MAKEFILE = Makefile
|
|---|
| 41 | !endif
|
|---|
| 42 |
|
|---|
| 43 | # Default makefile name.
|
|---|
| 44 | !ifndef MAKEFILE
|
|---|
| 45 | MAKEFILE = $(BUILD_MAKEFILE)
|
|---|
| 46 | !endif
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | # -----------------------------------------------------------------------------
|
|---|
| 50 | # Tell user what we're doing.
|
|---|
| 51 | # -----------------------------------------------------------------------------
|
|---|
| 52 | !ifndef BUILD_QUIET
|
|---|
| 53 | ! ifndef MAKEVER
|
|---|
| 54 | ! if [$(ECHO) Forwarding to another (shell) environment setup...$(CLRRST)]
|
|---|
| 55 | ! endif
|
|---|
| 56 | ! else
|
|---|
| 57 | $(ECHO) Forwarding to another (shell) environment setup...$(CLRRST)
|
|---|
| 58 | ! endif
|
|---|
| 59 | !endif
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 | # -----------------------------------------------------------------------------
|
|---|
| 63 | # Common inference rules
|
|---|
| 64 | # -----------------------------------------------------------------------------
|
|---|
| 65 |
|
|---|
| 66 | .SUFFIXES:
|
|---|
| 67 | .SUFFIXES: .c .cpp .asm .$(EXT_OBJ) .rc .$(EXT_RES) .ii .s
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 | # Assembling assembly source.
|
|---|
| 71 | .asm{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 72 | \
|
|---|
| 73 | !ifndef BUILD_VERBOSE
|
|---|
| 74 | @ \
|
|---|
| 75 | !endif
|
|---|
| 76 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 77 |
|
|---|
| 78 | .asm.$(EXT_OBJ):
|
|---|
| 79 | \
|
|---|
| 80 | !ifndef BUILD_VERBOSE
|
|---|
| 81 | @ \
|
|---|
| 82 | !endif
|
|---|
| 83 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 | # Compiling C++ source.
|
|---|
| 87 | .cpp{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 88 | \
|
|---|
| 89 | !ifndef BUILD_VERBOSE
|
|---|
| 90 | @ \
|
|---|
| 91 | !endif
|
|---|
| 92 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 93 |
|
|---|
| 94 | .cpp.$(EXT_OBJ):
|
|---|
| 95 | \
|
|---|
| 96 | !ifndef BUILD_VERBOSE
|
|---|
| 97 | @ \
|
|---|
| 98 | !endif
|
|---|
| 99 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | # Pre-Compiling C++ source.
|
|---|
| 103 | .cpp.ii:
|
|---|
| 104 | \
|
|---|
| 105 | !ifndef BUILD_VERBOSE
|
|---|
| 106 | @ \
|
|---|
| 107 | !endif
|
|---|
| 108 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 | # Compiler C++ source to assembly.
|
|---|
| 112 | .cpp.s:
|
|---|
| 113 | \
|
|---|
| 114 | !ifndef BUILD_VERBOSE
|
|---|
| 115 | @ \
|
|---|
| 116 | !endif
|
|---|
| 117 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 | # Compiling C source.
|
|---|
| 121 | .c{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 122 | \
|
|---|
| 123 | !ifndef BUILD_VERBOSE
|
|---|
| 124 | @ \
|
|---|
| 125 | !endif
|
|---|
| 126 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 127 |
|
|---|
| 128 | .c.$(EXT_OBJ):
|
|---|
| 129 | \
|
|---|
| 130 | !ifndef BUILD_VERBOSE
|
|---|
| 131 | @ \
|
|---|
| 132 | !endif
|
|---|
| 133 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 | # Pre-Compiling C source.
|
|---|
| 137 | .c.ii:
|
|---|
| 138 | \
|
|---|
| 139 | !ifndef BUILD_VERBOSE
|
|---|
| 140 | @ \
|
|---|
| 141 | !endif
|
|---|
| 142 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | # Compiler C source to assembly.
|
|---|
| 146 | .c.s:
|
|---|
| 147 | \
|
|---|
| 148 | !ifndef BUILD_VERBOSE
|
|---|
| 149 | @ \
|
|---|
| 150 | !endif
|
|---|
| 151 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 | # Compiling resources.
|
|---|
| 155 | .rc{$(PATH_TARGET)}.res:
|
|---|
| 156 | \
|
|---|
| 157 | !ifndef BUILD_VERBOSE
|
|---|
| 158 | @ \
|
|---|
| 159 | !endif
|
|---|
| 160 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 161 |
|
|---|
| 162 | .rc.res:
|
|---|
| 163 | \
|
|---|
| 164 | !ifndef BUILD_VERBOSE
|
|---|
| 165 | @ \
|
|---|
| 166 | !endif
|
|---|
| 167 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 | # -----------------------------------------------------------------------------
|
|---|
| 174 | # The all rule - The default one, as it's the first rule in the file.
|
|---|
| 175 | # -----------------------------------------------------------------------------
|
|---|
| 176 | all: build
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 | # -----------------------------------------------------------------------------
|
|---|
| 181 | # The build rule - Build the target.
|
|---|
| 182 | # -----------------------------------------------------------------------------
|
|---|
| 183 | build:
|
|---|
| 184 | \
|
|---|
| 185 | !ifndef BUILD_VERBOSE
|
|---|
| 186 | @ \
|
|---|
| 187 | !endif
|
|---|
| 188 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 | # -----------------------------------------------------------------------------
|
|---|
| 193 | # The lib rule - Make Public libraries.
|
|---|
| 194 | # -----------------------------------------------------------------------------
|
|---|
| 195 | lib:
|
|---|
| 196 | \
|
|---|
| 197 | !ifndef BUILD_VERBOSE
|
|---|
| 198 | @ \
|
|---|
| 199 | !endif
|
|---|
| 200 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 | # -----------------------------------------------------------------------------
|
|---|
| 205 | # The install rule - Copies target to main binary directory.
|
|---|
| 206 | # -----------------------------------------------------------------------------
|
|---|
| 207 | install:
|
|---|
| 208 | \
|
|---|
| 209 | !ifndef BUILD_VERBOSE
|
|---|
| 210 | @ \
|
|---|
| 211 | !endif
|
|---|
| 212 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 | # -----------------------------------------------------------------------------
|
|---|
| 217 | # The testcase rule - Execute testcases when present.
|
|---|
| 218 | # -----------------------------------------------------------------------------
|
|---|
| 219 | testcase:
|
|---|
| 220 | \
|
|---|
| 221 | !ifndef BUILD_VERBOSE
|
|---|
| 222 | @ \
|
|---|
| 223 | !endif
|
|---|
| 224 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 | # -----------------------------------------------------------------------------
|
|---|
| 229 | # The shell rule - Setup the correcte shell environment and start a shell.
|
|---|
| 230 | # -----------------------------------------------------------------------------
|
|---|
| 231 | shell:
|
|---|
| 232 | \
|
|---|
| 233 | !ifndef BUILD_VERBOSE
|
|---|
| 234 | @ \
|
|---|
| 235 | !endif
|
|---|
| 236 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(COMSPEC)
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 | # -----------------------------------------------------------------------------
|
|---|
| 241 | # The dep rule - Make dependencies.
|
|---|
| 242 | # -----------------------------------------------------------------------------
|
|---|
| 243 | dep:
|
|---|
| 244 | \
|
|---|
| 245 | !ifndef BUILD_VERBOSE
|
|---|
| 246 | @ \
|
|---|
| 247 | !endif
|
|---|
| 248 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 | # -----------------------------------------------------------------------------
|
|---|
| 253 | # The clean rule - Clean up output files.
|
|---|
| 254 | # The current setup doesn't clean the installed ones.
|
|---|
| 255 | # -----------------------------------------------------------------------------
|
|---|
| 256 | clean:
|
|---|
| 257 | \
|
|---|
| 258 | !ifndef BUILD_VERBOSE
|
|---|
| 259 | @ \
|
|---|
| 260 | !endif
|
|---|
| 261 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 265 | # -----------------------------------------------------------------------------
|
|---|
| 266 | # The nothing rule - Rule for testing the makefile structure.
|
|---|
| 267 | # -----------------------------------------------------------------------------
|
|---|
| 268 | nothing:
|
|---|
| 269 | \
|
|---|
| 270 | !ifndef BUILD_VERBOSE
|
|---|
| 271 | @ \
|
|---|
| 272 | !endif
|
|---|
| 273 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
|
|---|
| 277 | # -----------------------------------------------------------------------------
|
|---|
| 278 | # The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
|
|---|
| 279 | # -----------------------------------------------------------------------------
|
|---|
| 280 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
|
|---|
| 281 | $(TARGET):
|
|---|
| 282 | \
|
|---|
| 283 | !ifndef BUILD_VERBOSE
|
|---|
| 284 | @ \
|
|---|
| 285 | !endif
|
|---|
| 286 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 287 | !endif
|
|---|
| 288 |
|
|---|
| 289 |
|
|---|
| 290 |
|
|---|
| 291 | # -----------------------------------------------------------------------------
|
|---|
| 292 | # The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
|
|---|
| 293 | # -----------------------------------------------------------------------------
|
|---|
| 294 | !if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 295 | $(TARGET):
|
|---|
| 296 | \
|
|---|
| 297 | !ifndef BUILD_VERBOSE
|
|---|
| 298 | @ \
|
|---|
| 299 | !endif
|
|---|
| 300 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 301 | !endif
|
|---|
| 302 |
|
|---|
| 303 |
|
|---|
| 304 |
|
|---|
| 305 | # -----------------------------------------------------------------------------
|
|---|
| 306 | # The $(TARGET) rule - For EMPTY targets.
|
|---|
| 307 | # -----------------------------------------------------------------------------
|
|---|
| 308 | !if "$(TARGET_MODE)" == "EMPTY"
|
|---|
| 309 | $(TARGET):
|
|---|
| 310 | @$(ECHO) .
|
|---|
| 311 | !endif
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 | # -----------------------------------------------------------------------------
|
|---|
| 316 | # The $(TARGET_ILIB) rule - Make import library.
|
|---|
| 317 | # -----------------------------------------------------------------------------
|
|---|
| 318 | !ifdef TARGET_ILIB
|
|---|
| 319 | $(TARGET_ILIB):
|
|---|
| 320 | \
|
|---|
| 321 | !ifndef BUILD_VERBOSE
|
|---|
| 322 | @ \
|
|---|
| 323 | !endif
|
|---|
| 324 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 325 |
|
|---|
| 326 | !endif
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 | # -----------------------------------------------------------------------------
|
|---|
| 331 | # The .force rule - Force a remake of something everytime.
|
|---|
| 332 | # -----------------------------------------------------------------------------
|
|---|
| 333 | .force:
|
|---|
| 334 | \
|
|---|
| 335 | !ifndef BUILD_VERBOSE
|
|---|
| 336 | @$(ECHO) .
|
|---|
| 337 | !else
|
|---|
| 338 | @$(ECHO) . (force) .
|
|---|
| 339 | !endif
|
|---|
| 340 |
|
|---|
| 341 |
|
|---|