| 1 | # $Id: process.forwarder.mak,v 1.3 2002-05-16 11:36:59 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 | !if [$(ECHO) Forwarding to another (shell) environment setup...$(CLRRST)]
|
|---|
| 54 | !endif
|
|---|
| 55 | !endif
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | # -----------------------------------------------------------------------------
|
|---|
| 59 | # Common inference rules
|
|---|
| 60 | # -----------------------------------------------------------------------------
|
|---|
| 61 |
|
|---|
| 62 | .SUFFIXES:
|
|---|
| 63 | .SUFFIXES: .$(EXT_OBJ) .c .cpp .asm .$(EXT_RES) .rc .pre-c .pre-cpp # .h .def
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | # Assembling assembly source.
|
|---|
| 67 | .asm{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 68 | !ifndef BUILD_VERBOSE
|
|---|
| 69 | @ \
|
|---|
| 70 | !endif
|
|---|
| 71 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 72 |
|
|---|
| 73 | .asm.$(EXT_OBJ):
|
|---|
| 74 | !ifndef BUILD_VERBOSE
|
|---|
| 75 | @ \
|
|---|
| 76 | !endif
|
|---|
| 77 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 | # Compiling C++ source.
|
|---|
| 81 | .cpp{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 82 | !ifndef BUILD_VERBOSE
|
|---|
| 83 | @ \
|
|---|
| 84 | !endif
|
|---|
| 85 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 86 |
|
|---|
| 87 | .cpp.$(EXT_OBJ):
|
|---|
| 88 | !ifndef BUILD_VERBOSE
|
|---|
| 89 | @ \
|
|---|
| 90 | !endif
|
|---|
| 91 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | # Pre-Compiling C++ source.
|
|---|
| 95 | .cpp.pre-cpp:
|
|---|
| 96 | !ifndef BUILD_VERBOSE
|
|---|
| 97 | @ \
|
|---|
| 98 | !endif
|
|---|
| 99 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 | # Compiling C source.
|
|---|
| 103 | .c{$(PATH_TARGET)}.$(EXT_OBJ):
|
|---|
| 104 | !ifndef BUILD_VERBOSE
|
|---|
| 105 | @ \
|
|---|
| 106 | !endif
|
|---|
| 107 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 108 |
|
|---|
| 109 | .c.$(EXT_OBJ):
|
|---|
| 110 | !ifndef BUILD_VERBOSE
|
|---|
| 111 | @ \
|
|---|
| 112 | !endif
|
|---|
| 113 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 | # Pre-Compiling C source.
|
|---|
| 117 | .c.pre-c:
|
|---|
| 118 | !ifndef BUILD_VERBOSE
|
|---|
| 119 | @ \
|
|---|
| 120 | !endif
|
|---|
| 121 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 | # Compiling resources.
|
|---|
| 125 | .rc{$(PATH_TARGET)}.res:
|
|---|
| 126 | !ifndef BUILD_VERBOSE
|
|---|
| 127 | @ \
|
|---|
| 128 | !endif
|
|---|
| 129 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 130 |
|
|---|
| 131 | .rc.res:
|
|---|
| 132 | !ifndef BUILD_VERBOSE
|
|---|
| 133 | @ \
|
|---|
| 134 | !endif
|
|---|
| 135 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 | # -----------------------------------------------------------------------------
|
|---|
| 142 | # The all rule - The default one, as it's the first rule in the file.
|
|---|
| 143 | # -----------------------------------------------------------------------------
|
|---|
| 144 | all: build
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 | # -----------------------------------------------------------------------------
|
|---|
| 149 | # The build rule - Build the target.
|
|---|
| 150 | # -----------------------------------------------------------------------------
|
|---|
| 151 | build:
|
|---|
| 152 | !ifndef BUILD_VERBOSE
|
|---|
| 153 | @ \
|
|---|
| 154 | !endif
|
|---|
| 155 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 | # -----------------------------------------------------------------------------
|
|---|
| 160 | # The lib rule - Make Public libraries.
|
|---|
| 161 | # -----------------------------------------------------------------------------
|
|---|
| 162 | lib:
|
|---|
| 163 | !ifndef BUILD_VERBOSE
|
|---|
| 164 | @ \
|
|---|
| 165 | !endif
|
|---|
| 166 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 | # -----------------------------------------------------------------------------
|
|---|
| 171 | # The install rule - Copies target to main binary directory.
|
|---|
| 172 | # -----------------------------------------------------------------------------
|
|---|
| 173 | install:
|
|---|
| 174 | !ifndef BUILD_VERBOSE
|
|---|
| 175 | @ \
|
|---|
| 176 | !endif
|
|---|
| 177 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 | # -----------------------------------------------------------------------------
|
|---|
| 182 | # The testcase rule - Execute testcases when present.
|
|---|
| 183 | # -----------------------------------------------------------------------------
|
|---|
| 184 | testcase:
|
|---|
| 185 | !ifndef BUILD_VERBOSE
|
|---|
| 186 | @ \
|
|---|
| 187 | !endif
|
|---|
| 188 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 189 |
|
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 | # -----------------------------------------------------------------------------
|
|---|
| 193 | # The shell rule - Setup the correcte shell environment and start a shell.
|
|---|
| 194 | # -----------------------------------------------------------------------------
|
|---|
| 195 | shell:
|
|---|
| 196 | !ifndef BUILD_VERBOSE
|
|---|
| 197 | @ \
|
|---|
| 198 | !endif
|
|---|
| 199 | -$(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(COMSPEC)
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 | # -----------------------------------------------------------------------------
|
|---|
| 204 | # The dep rule - Make dependencies.
|
|---|
| 205 | # -----------------------------------------------------------------------------
|
|---|
| 206 | dep:
|
|---|
| 207 | !ifndef BUILD_VERBOSE
|
|---|
| 208 | @ \
|
|---|
| 209 | !endif
|
|---|
| 210 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 | # -----------------------------------------------------------------------------
|
|---|
| 215 | # The clean rule - Clean up output files.
|
|---|
| 216 | # The current setup doesn't clean the installed ones.
|
|---|
| 217 | # -----------------------------------------------------------------------------
|
|---|
| 218 | clean:
|
|---|
| 219 | !ifndef BUILD_VERBOSE
|
|---|
| 220 | @ \
|
|---|
| 221 | !endif
|
|---|
| 222 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 | # -----------------------------------------------------------------------------
|
|---|
| 227 | # The $(TARGET) rule - For EXE, DLL, SYS and IFS targets
|
|---|
| 228 | # -----------------------------------------------------------------------------
|
|---|
| 229 | !if "$(TARGET_MODE)" == "EXE" || "$(TARGET_MODE)" == "DLL" || "$(TARGET_MODE)" == "SYS" || "$(TARGET_MODE)" == "IFS" || "$(TARGET_MODE)" == "VDD"
|
|---|
| 230 | $(TARGET):
|
|---|
| 231 | !ifndef BUILD_VERBOSE
|
|---|
| 232 | @ \
|
|---|
| 233 | !endif
|
|---|
| 234 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 235 | !endif
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 | # -----------------------------------------------------------------------------
|
|---|
| 240 | # The $(TARGET) rule - For LIB, SYSLIB, and IFSLIB targets.
|
|---|
| 241 | # -----------------------------------------------------------------------------
|
|---|
| 242 | !if "$(TARGET_MODE)" == "LIB" || "$(TARGET_MODE)" == "SYSLIB" || "$(TARGET_MODE)" == "IFSLIB"
|
|---|
| 243 | $(TARGET):
|
|---|
| 244 | !ifndef BUILD_VERBOSE
|
|---|
| 245 | @ \
|
|---|
| 246 | !endif
|
|---|
| 247 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 248 | !endif
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 | # -----------------------------------------------------------------------------
|
|---|
| 253 | # The $(TARGET) rule - For EMPTY targets.
|
|---|
| 254 | # -----------------------------------------------------------------------------
|
|---|
| 255 | !if "$(TARGET_MODE)" == "EMPTY"
|
|---|
| 256 | $(TARGET):
|
|---|
| 257 | @$(ECHO) .
|
|---|
| 258 | !endif
|
|---|
| 259 |
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 | # -----------------------------------------------------------------------------
|
|---|
| 263 | # The $(TARGET_ILIB) rule - Make import library.
|
|---|
| 264 | # -----------------------------------------------------------------------------
|
|---|
| 265 | !ifdef TARGET_ILIB
|
|---|
| 266 | $(TARGET_ILIB):
|
|---|
| 267 | !ifndef BUILD_VERBOSE
|
|---|
| 268 | @ \
|
|---|
| 269 | !endif
|
|---|
| 270 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 271 |
|
|---|
| 272 | !endif
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 | # -----------------------------------------------------------------------------
|
|---|
| 277 | # The .force rule - Force a remake of something everytime.
|
|---|
| 278 | # -----------------------------------------------------------------------------
|
|---|
| 279 | .force:
|
|---|
| 280 | !ifndef BUILD_VERBOSE
|
|---|
| 281 | @$(ECHO) .
|
|---|
| 282 | !else
|
|---|
| 283 | @$(ECHO) . (force) .
|
|---|
| 284 | !endif
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|