| 1 | # $Id: process.forwarder.mak,v 1.8 2002-08-20 07:16:57 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" && "$(TARGET_MODE)" != "DEPEND"
|
|---|
| 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 | # Generic forwarder
|
|---|
| 182 | # -----------------------------------------------------------------------------
|
|---|
| 183 | build rebuild clean dep lib executable miscellaneous \
|
|---|
| 184 | !if "$(TARGET_MODE)" == "DEPEND"
|
|---|
| 185 | $(TARGET) \
|
|---|
| 186 | !endif
|
|---|
| 187 | $(TARGET_ILIB) \
|
|---|
| 188 | $(RULES_FORWARD) \
|
|---|
| 189 | install testcase nothing target:
|
|---|
| 190 | \
|
|---|
| 191 | !ifndef BUILD_VERBOSE
|
|---|
| 192 | @ \
|
|---|
| 193 | !endif
|
|---|
| 194 | !ifndef _BUILD_PROJECT # workaround for buggy SET implementation in NMAKE.
|
|---|
| 195 | echo . && SET _BUILD_PROJECT=$(BUILD_PROJECT) && \
|
|---|
| 196 | !endif
|
|---|
| 197 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(TOOL_MAKE) -f $(MAKEFILE) $@
|
|---|
| 198 |
|
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 | # -----------------------------------------------------------------------------
|
|---|
| 202 | # The shell rule - Setup the correcte shell environment and start a shell.
|
|---|
| 203 | # -----------------------------------------------------------------------------
|
|---|
| 204 | shell:
|
|---|
| 205 | \
|
|---|
| 206 | !ifndef BUILD_VERBOSE
|
|---|
| 207 | @ \
|
|---|
| 208 | !endif
|
|---|
| 209 | !ifndef _BUILD_PROJECT # workaround for buggy SET implementation in NMAKE.
|
|---|
| 210 | echo . && SET _BUILD_PROJECT=$(BUILD_PROJECT) && \
|
|---|
| 211 | !endif
|
|---|
| 212 | $(TOOL_BUILDENV) $(BUILD_ENVS_CHANGE) * $(COMSPEC)
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 | # -----------------------------------------------------------------------------
|
|---|
| 217 | # The $(TARGET) rule - For EMPTY & DEPEND targets.
|
|---|
| 218 | # -----------------------------------------------------------------------------
|
|---|
| 219 | !if "$(TARGET_MODE)" == "DEPEND"
|
|---|
| 220 | $(TARGET):
|
|---|
| 221 | @$(ECHO) .
|
|---|
| 222 | !endif
|
|---|
| 223 |
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 | # -----------------------------------------------------------------------------
|
|---|
| 227 | # The .force rule - Force a remake of something everytime.
|
|---|
| 228 | # -----------------------------------------------------------------------------
|
|---|
| 229 | .force:
|
|---|
| 230 | \
|
|---|
| 231 | !ifndef BUILD_VERBOSE
|
|---|
| 232 | @$(ECHO) .
|
|---|
| 233 | !else
|
|---|
| 234 | @$(ECHO) . (force) .
|
|---|
| 235 | !endif
|
|---|
| 236 |
|
|---|