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