1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 573502: Ensure post-build step is executed last

The post-build step may depend on secondary artifacts of the build and
should thus be executed last.

Contributed by STMicroelectronics

Change-Id: Iaf67f6b3e1fcab008798d2712e15d0a6a46ceae8
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
This commit is contained in:
Torbjörn Svensson 2021-05-12 15:28:03 +02:00
parent 00204a3c4c
commit 043651694a
34 changed files with 188 additions and 91 deletions

View file

@ -35,7 +35,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test1DepCalc2 all: main-build
# Main-build Target
main-build: test1DepCalc2
# Tool invocations # Tool invocations
test1DepCalc2: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test1DepCalc2: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -35,7 +35,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test1DepCalc3 all: main-build
# Main-build Target
main-build: test1DepCalc3
# Tool invocations # Tool invocations
test1DepCalc3: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test1DepCalc3: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -35,7 +35,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test1DepCalcPreBuild all: main-build
# Main-build Target
main-build: test1DepCalcPreBuild
# Tool invocations # Tool invocations
test1DepCalcPreBuild: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test1DepCalcPreBuild: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -48,7 +48,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test12.exe all: main-build
# Main-build Target
main-build: test12.exe
# Tool invocations # Tool invocations
test12.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test12.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -48,7 +48,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test20.exe all: main-build
# Main-build Target
main-build: test20.exe
# Tool invocations # Tool invocations
test20.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test20.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -34,7 +34,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: MBS2dot1.exe all: main-build
# Main-build Target
main-build: MBS2dot1.exe
# Tool invocations # Tool invocations
MBS2dot1.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) MBS2dot1.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -49,7 +49,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: Test21CXX all: main-build
# Main-build Target
main-build: Test21CXX
# Tool invocations # Tool invocations
Test21CXX: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) Test21CXX: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: liblinkedFolder.a all: main-build
# Main-build Target
main-build: liblinkedFolder.a
# Tool invocations # Tool invocations
liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: liblinkedLib.a all: main-build
# Main-build Target
main-build: liblinkedLib.a
# Tool invocations # Tool invocations
liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -48,7 +48,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: testResCfg all: main-build
# Main-build Target
main-build: testResCfg
# Tool invocations # Tool invocations
testResCfg: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) testResCfg: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: testSingleExe all: main-build
# Main-build Target
main-build: testSingleExe
# Tool invocations # Tool invocations
testSingleExe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) testSingleExe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -45,7 +45,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: libtestDoubleSO.so all: main-build
# Main-build Target
main-build: libtestDoubleSO.so
# Tool invocations # Tool invocations
libtestDoubleSO.so: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) libtestDoubleSO.so: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -27,7 +27,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: CDTFortranTest1.exe all: main-build
# Main-build Target
main-build: CDTFortranTest1.exe
# Tool invocations # Tool invocations
CDTFortranTest1.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) CDTFortranTest1.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -29,7 +29,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: CDTFortranTest2 all: main-build
# Main-build Target
main-build: CDTFortranTest2
# Tool invocations # Tool invocations
CDTFortranTest2: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) CDTFortranTest2: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -27,7 +27,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: TestATO.out all: main-build
# Main-build Target
main-build: TestATO.out
# Tool invocations # Tool invocations
TestATO.out: $(OBJS) $(OPT_SRCS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) TestATO.out: $(OBJS) $(OPT_SRCS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -37,7 +37,10 @@ USER_OBJS.foo \
# All Target # All Target
all: TestCopyandDeploy all: main-build
# Main-build Target
main-build: TestCopyandDeploy
# Tool invocations # Tool invocations
TestCopyandDeploy: $(EXECUTABLES) makefile objects.mk $(OPTIONAL_TOOL_DEPS) TestCopyandDeploy: $(EXECUTABLES) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -45,7 +45,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: DeleteFile all: main-build
# Main-build Target
main-build: DeleteFile
# Tool invocations # Tool invocations
DeleteFile: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) DeleteFile: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: inputTypeOption all: main-build
# Main-build Target
main-build: inputTypeOption
# Tool invocations # Tool invocations
inputTypeOption: $(OBJS) C:\An\ Absolute\ Path\ With\ Spaces\foo.linker $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) inputTypeOption: $(OBJS) C:\An\ Absolute\ Path\ With\ Spaces\foo.linker $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: liblinkedFolder.a all: main-build
# Main-build Target
main-build: liblinkedFolder.a
# Tool invocations # Tool invocations
liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: liblinkedLib.a all: main-build
# Main-build Target
main-build: liblinkedLib.a
# Tool invocations # Tool invocations
liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -48,7 +48,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: multiResConfig all: main-build
# Main-build Target
main-build: multiResConfig
# Tool invocations # Tool invocations
multiResConfig: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) multiResConfig: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -46,8 +46,7 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# All Target # All Target
all: all:
$(MAKE) --no-print-directory pre-build +@$(MAKE) --no-print-directory pre-build && $(MAKE) --no-print-directory main-build && $(MAKE) --no-print-directory post-build
$(MAKE) --no-print-directory main-build
# Main-build Target # Main-build Target
main-build: preAndPostBuildSteps main-build: preAndPostBuildSteps
@ -59,7 +58,6 @@ preAndPostBuildSteps: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_D
g++ -o "preAndPostBuildSteps" $(OBJS) $(USER_OBJS) $(LIBS) g++ -o "preAndPostBuildSteps" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@' @echo 'Finished building target: $@'
@echo ' ' @echo ' '
$(MAKE) --no-print-directory post-build
# Other Targets # Other Targets
clean: clean:

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: rcbsBasicTest all: main-build
# Main-build Target
main-build: rcbsBasicTest
# Tool invocations # Tool invocations
rcbsBasicTest: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) rcbsBasicTest: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: singleFileExe all: main-build
# Main-build Target
main-build: singleFileExe
# Tool invocations # Tool invocations
singleFileExe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) singleFileExe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -34,7 +34,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_AR
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: testwithspaces.exe all: main-build
# Main-build Target
main-build: testwithspaces.exe
# Tool invocations # Tool invocations
testwithspaces.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) testwithspaces.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -39,7 +39,10 @@ test30_1.so.1.2.3 \
# All Target # All Target
all: Test30_1.so.4.5.6 secondary-outputs all: main-build
# Main-build Target
main-build: Test30_1.so.4.5.6 secondary-outputs
# Tool invocations # Tool invocations
Test30_1.so.4.5.6: $(EXECUTABLES) makefile objects.mk $(OPTIONAL_TOOL_DEPS) Test30_1.so.4.5.6: $(EXECUTABLES) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -34,7 +34,10 @@ new.log \
# All Target # All Target
all: test30_2.tmp all: main-build
# Main-build Target
main-build: test30_2.tmp
# Tool invocations # Tool invocations
test30_2.tmp: $(LOGFILE) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test30_2.tmp: $(LOGFILE) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test.exe all: main-build
# Main-build Target
main-build: test.exe
# Tool invocations # Tool invocations
test.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -27,7 +27,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: testMacroSupportInBuildDefinitions.tar all: main-build
# Main-build Target
main-build: testMacroSupportInBuildDefinitions.tar
# Tool invocations # Tool invocations
testMacroSupportInBuildDefinitions.tar: $(BAR_FILES) makefile objects.mk $(OPTIONAL_TOOL_DEPS) testMacroSupportInBuildDefinitions.tar: $(BAR_FILES) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -33,7 +33,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: libtwoFileSO.SOS all: main-build
# Main-build Target
main-build: libtwoFileSO.SOS
# Tool invocations # Tool invocations
libtwoFileSO.SOS: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) libtwoFileSO.SOS: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -56,7 +56,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test_40 all: main-build
# Main-build Target
main-build: test_40
# Tool invocations # Tool invocations
test_40: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test_40: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -56,7 +56,10 @@ BUILD_ARTIFACT := $(BUILD_ARTIFACT_PREFIX)$(BUILD_ARTIFACT_NAME)$(if $(BUILD_ART
# Add inputs and outputs from these tool invocations to the build variables # Add inputs and outputs from these tool invocations to the build variables
# All Target # All Target
all: test_40 all: main-build
# Main-build Target
main-build: test_40
# Tool invocations # Tool invocations
test_40: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS) test_40: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)

View file

@ -1384,57 +1384,46 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
.equals(config.getBuildArtefactType().getId())) .equals(config.getBuildArtefactType().getId()))
refConfigs = ManagedBuildManager.getReferencedConfigurations(config); refConfigs = ManagedBuildManager.getReferencedConfigurations(config);
/* try { // Add the comment for the "All" target
refdProjects = project.getReferencedProjects(); buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(ALL_TARGET))
} catch (CoreException e) { .append(NEWLINE);
// There are 2 exceptions; the project does not exist or it is not open
// and neither conditions apply if we are building for it ....
}
*/
// If a prebuild step exists, redefine the all target to be
// all:
// $(MAKE) pre-build
// $(MAKE) main-build
// and then reset the "traditional" all target to main-build
// This will allow something meaningful to happen if the generated
// makefile is
// extracted and run standalone via "make all"
//
String defaultTarget = "all:"; //$NON-NLS-1$
if (prebuildStep.length() > 0) {
// Add the comment for the "All" target if (!prebuildStep.isEmpty() || !postbuildStep.isEmpty()) {
buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(ALL_TARGET)) // all:
.append(NEWLINE); buffer.append("all").append(COLON).append(NEWLINE); //$NON-NLS-1$
String makeNoPrintDir = MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE;
buffer.append(TAB).append("+@"); //$NON-NLS-1$
if (!prebuildStep.isEmpty()) {
buffer.append(makeNoPrintDir).append(PREBUILD).append(WHITESPACE).append(LOGICAL_AND)
.append(WHITESPACE);
}
buffer.append(makeNoPrintDir).append(MAINBUILD);
if (!postbuildStep.isEmpty()) {
buffer.append(WHITESPACE).append(LOGICAL_AND).append(WHITESPACE).append(makeNoPrintDir)
.append(POSTBUILD);
}
// Invoke make multiple times to ensure pre-build is executed before main-build
buffer.append(defaultTarget).append(NEWLINE);
buffer.append(TAB).append(MAKE).append(WHITESPACE).append(NO_PRINT_DIR).append(WHITESPACE).append(PREBUILD)
.append(NEWLINE);
buffer.append(TAB).append(MAKE).append(WHITESPACE).append(NO_PRINT_DIR).append(WHITESPACE).append(MAINBUILD)
.append(NEWLINE);
buffer.append(NEWLINE); buffer.append(NEWLINE);
// Update the defaultTarget, main-build, by adding a colon, which is } else {
// needed below // all: main-build
defaultTarget = MAINBUILD.concat(COLON); buffer.append("all").append(COLON).append(WHITESPACE).append(MAINBUILD).append(NEWLINE); //$NON-NLS-1$
}
buffer.append(NEWLINE);
// Add the comment for the "main-build" target // Add the comment for the "main-build" target
buffer.append(COMMENT_SYMBOL).append(WHITESPACE) buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(MAINBUILD_TARGET))
.append(ManagedMakeMessages.getResourceString(MAINBUILD_TARGET)).append(NEWLINE); .append(NEWLINE);
} else
// Add the comment for the "All" target
buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(ALL_TARGET))
.append(NEWLINE);
// Write out the all target first in case someone just runs make // Write out the main-build target first in case someone just runs make
// all: <target_name> or mainbuild: <target_name> // main-build: <target_name>
String outputPrefix = EMPTY_STRING; String outputPrefix = EMPTY_STRING;
if (targetTool != null) { if (targetTool != null) {
outputPrefix = targetTool.getOutputPrefix(); outputPrefix = targetTool.getOutputPrefix();
} }
buffer.append(defaultTarget).append(WHITESPACE).append(outputPrefix) buffer.append(MAINBUILD).append(COLON).append(WHITESPACE).append(outputPrefix)
.append(ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName)); .append(ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName));
if (buildTargetExt.length() > 0) { if (buildTargetExt.length() > 0) {
buffer.append(DOT).append(buildTargetExt); buffer.append(DOT).append(buildTargetExt);
@ -1519,8 +1508,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
} }
// Add the targets tool rules // Add the targets tool rules
buffer.append(addTargetsRules(targetTool, outputVarsAdditionsList, managedProjectOutputs, buffer.append(addTargetsRules(targetTool, outputVarsAdditionsList, managedProjectOutputs));
(postbuildStep.length() > 0)));
// Add the prebuild step target, if specified // Add the prebuild step target, if specified
if (prebuildStep.length() > 0) { if (prebuildStep.length() > 0) {
@ -1584,7 +1572,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* @return StringBuffer * @return StringBuffer
*/ */
private StringBuffer addTargetsRules(ITool targetTool, List<String> outputVarsAdditionsList, private StringBuffer addTargetsRules(ITool targetTool, List<String> outputVarsAdditionsList,
Vector<String> managedProjectOutputs, boolean postbuildStep) { Vector<String> managedProjectOutputs) {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the comment // Add the comment
buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(BUILD_TOP)) buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(BUILD_TOP))
@ -1599,7 +1587,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// appear to be used there (and tool outputs are consulted directly), but // appear to be used there (and tool outputs are consulted directly), but
// we quote it anyway just in case it starts to use it in future. // we quote it anyway just in case it starts to use it in future.
if (addRuleForTool(targetTool, buffer, true, ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName), if (addRuleForTool(targetTool, buffer, true, ensurePathIsGNUMakeTargetRuleCompatibleSyntax(buildTargetName),
buildTargetExt, outputVarsAdditionsList, managedProjectOutputs, postbuildStep)) { buildTargetExt, outputVarsAdditionsList, managedProjectOutputs, false)) {
// Mark the target tool as processed // Mark the target tool as processed
for (int i = 0; i < buildTools.length; i++) { for (int i = 0; i < buildTools.length; i++) {
if (targetTool == buildTools[i]) { if (targetTool == buildTools[i]) {
@ -1658,6 +1646,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
return buffer; return buffer;
} }
/**
* @deprecated Use {@link #addRuleForTool(ITool, StringBuffer, boolean, String, String, List, Vector)}
*/
@Deprecated
protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTargetTool, String targetName,
String targetExt, List<String> outputVarsAdditionsList, Vector<String> managedProjectOutputs,
boolean bEmitPostBuildStepCall) {
return addRuleForTool(tool, buffer, bTargetTool, targetName, targetExt, outputVarsAdditionsList,
managedProjectOutputs);
}
/** /**
* Create the rule * Create the rule
* *
@ -1667,11 +1666,10 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* @param targetExt If this is the "targetTool", the target file extension, else <code>null</code> * @param targetExt If this is the "targetTool", the target file extension, else <code>null</code>
* @param outputVarsAdditionsList list to add needed build output variables to * @param outputVarsAdditionsList list to add needed build output variables to
* @param managedProjectOutputs Other projects in the workspace that this project depends upon * @param managedProjectOutputs Other projects in the workspace that this project depends upon
* @param bEmitPostBuildStepCall Emit post-build step invocation * @since 9.3
*/ */
protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTargetTool, String targetName, protected boolean addRuleForTool(ITool tool, StringBuffer buffer, boolean bTargetTool, String targetName,
String targetExt, List<String> outputVarsAdditionsList, Vector<String> managedProjectOutputs, String targetExt, List<String> outputVarsAdditionsList, Vector<String> managedProjectOutputs) {
boolean bEmitPostBuildStepCall) {
// Get the tool's inputs and outputs // Get the tool's inputs and outputs
Vector<String> inputs = new Vector<>(); Vector<String> inputs = new Vector<>();
@ -1805,16 +1803,8 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
escapedEcho((bTargetTool ? MESSAGE_FINISH_BUILD : MESSAGE_FINISH_FILE) + WHITESPACE + OUT_MACRO)); escapedEcho((bTargetTool ? MESSAGE_FINISH_BUILD : MESSAGE_FINISH_FILE) + WHITESPACE + OUT_MACRO));
buffer.append(TAB).append(AT).append(ECHO_BLANK_LINE); buffer.append(TAB).append(AT).append(ECHO_BLANK_LINE);
// If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build // Just emit a blank line
// Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke buffer.append(NEWLINE);
// the makefile originally
if (bEmitPostBuildStepCall) {
buffer.append(TAB).append(MAKE).append(WHITESPACE).append(NO_PRINT_DIR).append(WHITESPACE)
.append(POSTBUILD).append(NEWLINE).append(NEWLINE);
} else {
// Just emit a blank line
buffer.append(NEWLINE);
}
} }
// If we have secondary outputs, output dependency rules without commands // If we have secondary outputs, output dependency rules without commands

View file

@ -62,6 +62,7 @@
<ol> <ol>
<li><a href="#gdbBackendDebuggerCommandLine">Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb</a></li> <li><a href="#gdbBackendDebuggerCommandLine">Rework of API to determine GDB command line in org.eclipse.cdt.dsf.gdb</a></li>
<li><a name="ManagedCommandLineGenerator.toManagedCommandLineInfo">Add ITool parameter to ManagedCommandLineGenerator.toManagedCommandLineInfo</a></li> <li><a name="ManagedCommandLineGenerator.toManagedCommandLineInfo">Add ITool parameter to ManagedCommandLineGenerator.toManagedCommandLineInfo</a></li>
<li><a name="GnuMakefileGenerator.addRuleForTool">Removed unneded boolean from function</a></li>
</ol> </ol>
<hr> <hr>
@ -437,6 +438,21 @@
<p> <p>
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=573254" target="_blank">Bug 573254</a>. See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=573254" target="_blank">Bug 573254</a>.
</p> </p>
<h3>3. <a name="GnuMakefileGenerator.addRuleForTool">Removed unneded boolean from function</a></h3>
<p>
The implementation for how post-build steps are generated was changed. The "bEmitPostBuildStepCall"-parameter is thus no longer needed.
</p>
<ul>
<li>org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.addRuleForTool(ITool, StringBuffer, boolean, String, String, List&lt;String&gt;, Vector&lt;String&gt;, boolean)</li>
</ul>
<p>
Extenders that override the above protected method should override
org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator.addRuleForTool(ITool, StringBuffer, boolean, String, String, List&lt;String&gt;, Vector&lt;String&gt;) instead.
</p>
<p>
See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=573502" target="_blank">Bug 573502</a>.
</p>
</body> </body>
</html> </html>