1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 09:16:02 +02:00

Bug 577263: CommandGenerator not respected for option value type libs

Contributed by STMicroelectronics

Change-Id: I2c332eb40b6b69aff405c2c7c86cdcd4acaf5d19
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
Also-By: Erik Hentschke <erik.hentschke@bachmann.info>
Also-By: John Dallaway <john@dallaway.org.uk>
This commit is contained in:
Torbjörn Svensson 2022-01-19 16:50:24 +01:00 committed by Jonah Graham
parent d224fec1da
commit 2a669100f0
47 changed files with 309 additions and 245 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core.tests; singleton:=true
Bundle-Version: 8.2.100.qualifier
Bundle-Version: 8.2.200.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -11,7 +11,6 @@ RM := rm
-include Sources/sub\ sources/subdir.mk
-include Sources/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -41,7 +40,7 @@ all: main-build
main-build: test1DepCalc2
# Tool invocations
test1DepCalc2: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test1DepCalc2: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
gcc -o "test1DepCalc2" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -11,7 +11,6 @@ RM := rm
-include Sources/sub\ sources/subdir.mk
-include Sources/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -41,7 +40,7 @@ all: main-build
main-build: test1DepCalc3
# Tool invocations
test1DepCalc3: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test1DepCalc3: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
gcc -o "test1DepCalc3" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -11,7 +11,6 @@ RM := rm
-include Sources/sub\ sources/subdir.mk
-include Sources/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -41,7 +40,7 @@ all: main-build
main-build: test1DepCalcPreBuild
# Tool invocations
test1DepCalcPreBuild: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test1DepCalcPreBuild: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
gcc -o "test1DepCalcPreBuild" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
@ -54,7 +53,7 @@ all: main-build
main-build: test12.exe
# Tool invocations
test12.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test12.exe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: Cygwin C++ Linker'
g++ -o "test12.exe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
@ -54,7 +53,7 @@ all: main-build
main-build: test20.exe
# Tool invocations
test20.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test20.exe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: Cygwin C++ Linker'
g++ -o "test20.exe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -10,7 +10,6 @@ RM := rm -rf
-include sources.mk
-include Functions/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -40,7 +39,7 @@ all: main-build
main-build: MBS2dot1.exe
# Tool invocations
MBS2dot1.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
MBS2dot1.exe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
gcc -o "MBS2dot1.exe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -10,7 +10,6 @@ RM := rm -rf
-include sources.mk
-include Functions/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
@ -55,7 +54,7 @@ all: main-build
main-build: Test21CXX
# Tool invocations
Test21CXX: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
Test21CXX: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -o "Test21CXX" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: liblinkedFolder.a
# Tool invocations
liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: archiver.gnu'
ar -r "liblinkedFolder.a" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: liblinkedLib.a
# Tool invocations
liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: archiver.gnu'
ar -r "liblinkedLib.a" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -12,7 +12,6 @@ RM := rm -rf
-include source2/subdir.mk
-include source1/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
@ -54,7 +53,7 @@ all: main-build
main-build: testResCfg
# Tool invocations
testResCfg: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
testResCfg: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: linker.gnu.cpp'
g++ --strip-all -o "testResCfg" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: testSingleExe
# Tool invocations
testSingleExe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
testSingleExe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: linker.gnu.c'
gcc -o "testSingleExe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
@ -51,7 +50,7 @@ all: main-build
main-build: libtestDoubleSO.so
# Tool invocations
libtestDoubleSO.so: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
libtestDoubleSO.so: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: linker.gnu.cpp'
g++ -shared -o "libtestDoubleSO.so" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
-include ../makefile.defs
@ -33,7 +32,7 @@ all: main-build
main-build: CDTFortranTest1.exe
# Tool invocations
CDTFortranTest1.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
CDTFortranTest1.exe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: Linker'
mylink -o "CDTFortranTest1.exe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -10,7 +10,6 @@ RM := rm -rf
-include sources.mk
-include module/subdir.mk
-include Sources/subdir.mk
-include objects.mk
-include ../makefile.defs
@ -34,7 +33,7 @@ all: main-build
main-build: CDTFortranTest2
# Tool invocations
CDTFortranTest2: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
CDTFortranTest2: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: Linker'
mylink -o "CDTFortranTest2" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
-include ../makefile.defs
@ -33,7 +32,7 @@ all: main-build
main-build: TestATO.out
# Tool invocations
TestATO.out: $(OBJS) $(OPT_SRCS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
TestATO.out: $(OBJS) $(OPT_SRCS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: AssignToOption Executable Linker'
ATOL -opt../TestATO1.opt -opt../TestATO2.opt -o "TestATO.out" $(OBJS)

View file

@ -10,7 +10,6 @@ RM := rm -rf
-include sources.mk
-include Functions/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -43,14 +42,14 @@ all: main-build
main-build: TestCopyandDeploy
# Tool invocations
TestCopyandDeploy: $(EXECUTABLES) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
TestCopyandDeploy: $(EXECUTABLES) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: Deploy tool'
cp $(EXECUTABLES) "TestCopyandDeploy"
@echo 'Finished building target: $@'
@echo ' '
USER_OBJS.foo: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
USER_OBJS.foo: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Invoking: MBS30.linker.gnu.c'
gcc -o "USER_OBJS.foo" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building: $@'

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
@ -51,7 +50,7 @@ all: main-build
main-build: DeleteFile
# Tool invocations
DeleteFile: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
DeleteFile: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.linker.gnu.cpp'
g++ -o "DeleteFile" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: inputTypeOption
# 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 $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.linker'
gcc --linkerInputTypeOption="C:\An Absolute Path With Spaces\foo.linker" -o "inputTypeOption" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: liblinkedFolder.a
# Tool invocations
liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
liblinkedFolder.a: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.archiver.gnu'
ar -r "liblinkedFolder.a" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: liblinkedLib.a
# Tool invocations
liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
liblinkedLib.a: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.archiver.gnu'
ar -r "liblinkedLib.a" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -12,7 +12,6 @@ RM := rm -rf
-include source2/subdir.mk
-include source1/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
@ -54,7 +53,7 @@ all: main-build
main-build: multiResConfig
# Tool invocations
multiResConfig: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
multiResConfig: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.linker.gnu.cpp'
g++ -o "multiResConfig" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
@ -52,7 +51,7 @@ all:
main-build: preAndPostBuildSteps
# Tool invocations
preAndPostBuildSteps: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
preAndPostBuildSteps: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.linker.gnu.cpp'
g++ -o "preAndPostBuildSteps" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: rcbsBasicTest
# Tool invocations
rcbsBasicTest: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
rcbsBasicTest: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.linker.gnu.c'
gcc -o "rcbsBasicTest" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: singleFileExe
# Tool invocations
singleFileExe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
singleFileExe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.linker.gnu.c'
gcc -o "singleFileExe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -10,7 +10,6 @@ RM := rm -rf
-include sources.mk
-include sub\ folder\ with\ spaces/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -40,7 +39,7 @@ all: main-build
main-build: testwithspaces.exe
# Tool invocations
testwithspaces.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
testwithspaces.exe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
gcc -o "testwithspaces.exe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -45,7 +44,7 @@ all: main-build
main-build: Test30_1.so.4.5.6 secondary-outputs
# Tool invocations
Test30_1.so.4.5.6: $(EXECUTABLES) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
Test30_1.so.4.5.6: $(EXECUTABLES) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: Deploy tool'
cp $(EXECUTABLES) "Test30_1.so.4.5.6"
@ -54,7 +53,7 @@ Test30_1.so.4.5.6: $(EXECUTABLES) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
default.so.4.5.6: Test30_1.so.4.5.6 $(EXECUTABLES)
test30_1.so.1.2.3: $(STRIPPEDOBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test30_1.so.1.2.3: $(STRIPPEDOBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Invoking: MBS30.linker.gnu.c'
gcc -shared -Wl,-soname=test30_1.so.1.2.3 -o "test30_1.so.1.2.3" $(STRIPPEDOBJS)
@echo 'Finished building: $@'

View file

@ -10,7 +10,6 @@ RM := rm -rf
-include sources.mk
-include ABC/subdir.mk
-include subdir.mk
-include objects.mk
-include ../makefile.defs
@ -49,26 +48,26 @@ all: main-build
main-build: test30_2.tmp
# Tool invocations
test30_2.tmp: $(LOGFILE) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test30_2.tmp: $(LOGFILE) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: cat'
cat $(LOGFILE)
@echo 'Finished building target: $@'
@echo ' '
new.tar: $(CPP_SRCS) $(ASM_SRCS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
new.tar: $(CPP_SRCS) $(ASM_SRCS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Invoking: tar-create'
tar -cf new.tar $(CPP_SRCS) $(ASM_SRCS)
@echo 'Finished building: $@'
@echo ' '
new.log: $(TAROUT) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
new.log: $(TAROUT) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Invoking: tar-list'
tar -tf $(TAROUT) > new.log
@echo 'Finished building: $@'
@echo ' '
these file\ names are not in alphabetical order: $(LOGFILE) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
these file\ names are not in alphabetical order: $(LOGFILE) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Invoking: touch'
touch -r $(LOGFILE) "these" "file names" "are" "not" "in" "alphabetical" "order"
@echo 'Finished building: $@'

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: test.exe
# Tool invocations
test.exe: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test.exe: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C Linker'
gcc -o "test.exe" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -9,7 +9,6 @@ RM := rm
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
-include ../makefile.defs
@ -33,7 +32,7 @@ all: main-build
main-build: testMacroSupportInBuildDefinitions.tar
# Tool invocations
testMacroSupportInBuildDefinitions.tar: $(BAR_FILES) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
testMacroSupportInBuildDefinitions.tar: $(BAR_FILES) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: Bar Tool'
tar cvf $@ $(BAR_FILES)

View file

@ -9,7 +9,6 @@ RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
@ -39,7 +38,7 @@ all: main-build
main-build: libtwoFileSO.SOS
# Tool invocations
libtwoFileSO.SOS: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
libtwoFileSO.SOS: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS)
@echo 'Building target: $@'
@echo 'Invoking: MBS30.linker.gnu.c'
gcc -shared -o "libtwoFileSO.SOS" $(OBJS) $(USER_OBJS) $(LIBS)

View file

@ -16,7 +16,6 @@ RM := rm -rf
-include d1/d2/d3/subdir.mk
-include d1/d2/subdir.mk
-include d1/subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
@ -61,10 +60,10 @@ all: main-build
main-build: test_40
# Tool invocations
test_40: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test_40: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS) uo1
@echo 'Building target: $@'
@echo 'Invoking: Test 4.0 ToolName.linker.gnu.cpp'
g++ -Llib/path/1 -o "test_40" $(OBJS) $(USER_OBJS) $(LIBS)
g++ -Llib/path/1 -o "test_40" $(OBJS) $(USER_OBJS) $(LIBS) uo1 -llib1
@echo 'Finished building target: $@'
@echo ' '

View file

@ -2,7 +2,7 @@
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS := uo1
USER_OBJS :=
LIBS := -llib1
LIBS :=

View file

@ -16,7 +16,6 @@ RM := rm -rf
-include d1/d2/d3/subdir.mk
-include d1/d2/subdir.mk
-include d1/subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C++_DEPS)),)
@ -61,10 +60,10 @@ all: main-build
main-build: test_40
# Tool invocations
test_40: $(OBJS) $(USER_OBJS) makefile objects.mk $(OPTIONAL_TOOL_DEPS)
test_40: $(OBJS) $(USER_OBJS) makefile $(OPTIONAL_TOOL_DEPS) uo2
@echo 'Building target: $@'
@echo 'Invoking: Test 4.0 ToolName.linker.gnu.cpp'
g++ -Llib/path/2 -o "test_40" $(OBJS) $(USER_OBJS) $(LIBS)
g++ -Llib/path/2 -o "test_40" $(OBJS) $(USER_OBJS) $(LIBS) uo2 -llib2
@echo 'Finished building target: $@'
@echo ' '

View file

@ -2,7 +2,7 @@
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS := uo2
USER_OBJS :=
LIBS := -llib2
LIBS :=

View file

@ -219,7 +219,6 @@ public abstract class AbstractBuilderTest {
resources.add(buildDir);
if (externalBuilder) {
resources.add(buildDir.getFile("makefile"));
resources.add(buildDir.getFile("objects.mk"));
resources.add(buildDir.getFile("sources.mk"));
}
for (String obj : objs) {

View file

@ -69,8 +69,8 @@ public class BuildSystem40Tests extends TestCase {
}
public void test40() throws Exception {
String[] makefiles = { "makefile", "objects.mk", "sources.mk", "d1/subdir.mk", "d1/d2/subdir.mk",
"d1/d2/d3/subdir.mk", "d1_1/subdir.mk", "d1_1/d2_1/subdir.mk", "dir1/dd/excluded_c/subdir.mk",
String[] makefiles = { "makefile", "sources.mk", "d1/subdir.mk", "d1/d2/subdir.mk", "d1/d2/d3/subdir.mk",
"d1_1/subdir.mk", "d1_1/d2_1/subdir.mk", "dir1/dd/excluded_c/subdir.mk",
"dir1/dd/excluded_c/asd/subdir.mk", "dir1/dd/ff/subdir.mk", };
IProject[] projects = createProjects("test_40", null, null, true);
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();

View file

@ -184,8 +184,8 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase {
* test for dependency calculation as a side-effect of compilation
*/
public void test1DepCalc2() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"),
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"),
// This file is different using Cygwin vs GCC
//Path.fromOSString("main.d"),
Path.fromOSString("Sources/subdir.mk"), Path.fromOSString("Sources/func1.d"),
@ -199,8 +199,8 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase {
* test for dependency calculation using Echo, a 2nd conmpilation step, and post-processing
*/
public void test1DepCalc3() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"),
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"),
// This file is different using Cygwin vs GCC
//Path.fromOSString("main.d"),
Path.fromOSString("Sources/subdir.mk"), Path.fromOSString("Sources/func1.d"),
@ -214,8 +214,8 @@ public class ManagedBuildDependencyCalculatorTests extends TestCase {
* test for dependency calculation that uses a separate, pre-build, step to generate dependency files
*/
public void test1DepCalcPreBuild() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"),
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"),
// This file is different using Cygwin vs GCC
//Path.fromOSString("main.d"),
Path.fromOSString("Sources/subdir.mk"), Path.fromOSString("Sources/func1.d"),

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2011 Intel Corporation and others.
* Copyright (c) 2004, 2022 Intel Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -17,6 +17,7 @@ package org.eclipse.cdt.managedbuilder.core.tests;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
@ -42,7 +43,9 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
"${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT}",
"${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT}",
"${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}",
"${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${EXTRA_FLAGS}",
"${command} ${flags} ${output_flag}${output_prefix}${output} ${WRONG_VAR_NAME}" };
private static String TEST_TOOL_ID = "test.four.dot.zero.cdt.managedbuild.tool.gnu.c.linker";
private static String COMMAND_VAL = "[command]";
private static String FLAGS_VAL = "[flags]";
private static String[] FLAGS_ARRAY_VAL = FLAGS_VAL.split("\\s");
@ -51,15 +54,20 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
private static String OUTPUT_VAL = "[output]";
private static String INPUTS_VAL = "[inputs]";
private static String[] INPUTS_ARRAY_VAL = INPUTS_VAL.split("\\s");
private static String[] OBJECTS_ARRAY_VAL = new String[] { "obj0", "obj1" };
private static String[] LIBRARIES_ARRAY_VAL = new String[] { "lib0", "lib1" };
private static String EXTRA_FLAGS = "obj0 obj1 -llib0 -llib1";
private static String[] commandLineEtalonesForPatterns = {
COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + " " + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\""
+ " " + "\"" + INPUTS_VAL + "\"",
+ " " + "\"" + INPUTS_VAL + "\" " + EXTRA_FLAGS,
COMMAND_VAL, COMMAND_VAL + " " + FLAGS_VAL, COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL,
COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL,
COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"",
COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + " " + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"",
COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"" + " "
+ "\"" + INPUTS_VAL + "\"",
COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"" + " "
+ "\"" + INPUTS_VAL + "\" " + EXTRA_FLAGS,
COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"" + " "
+ "${WRONG_VAR_NAME}" };
@ -71,11 +79,14 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
return new TestSuite(ManagedCommandLineGeneratorTest.class);
}
public final void testGenerateCommandLineInfoPatterns() {
public final void testGenerateCommandLineInfoPatterns() throws BuildException {
ITool tool = ManagedBuildManager.getExtensionTool(TEST_TOOL_ID);
setToolOptionByType(tool, IOption.OBJECTS, OBJECTS_ARRAY_VAL);
setToolOptionByType(tool, IOption.LIBRARIES, LIBRARIES_ARRAY_VAL);
IManagedCommandLineGenerator gen = new ManagedCommandLineGenerator();
IManagedCommandLineInfo info = null;
for (int i = 0; i < testCommandLinePatterns.length; i++) {
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
info = gen.generateCommandLineInfo(tool, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
OUTPUT_VAL, INPUTS_ARRAY_VAL, testCommandLinePatterns[i]);
assertNotNull(info);
if (i < commandLineEtalonesForPatterns.length) {
@ -84,59 +95,63 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
}
}
public final void testGenerateCommandLineInfoDoublePattern() {
public final void testGenerateCommandLineInfoDoublePattern() throws BuildException {
ITool tool = ManagedBuildManager.getExtensionTool(TEST_TOOL_ID);
IManagedCommandLineGenerator gen = new ManagedCommandLineGenerator();
IManagedCommandLineInfo info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
IManagedCommandLineInfo info = gen.generateCommandLineInfo(tool, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, "${OUTPUT_FLAG} ${OUTPUT_FLAG}");
assertNotNull(info);
assertEquals(OUTPUT_FLAG_VAL + " " + OUTPUT_FLAG_VAL, info.getCommandLine());
}
public final void testGenerateCommandLineInfoParameters() {
public final void testGenerateCommandLineInfoParameters() throws BuildException {
ITool tool = ManagedBuildManager.getExtensionTool(TEST_TOOL_ID);
setToolOptionByType(tool, IOption.OBJECTS, OBJECTS_ARRAY_VAL);
setToolOptionByType(tool, IOption.LIBRARIES, LIBRARIES_ARRAY_VAL);
IManagedCommandLineGenerator gen = new ManagedCommandLineGenerator();
IManagedCommandLineInfo info = gen.generateCommandLineInfo(null, "", FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
IManagedCommandLineInfo info = gen.generateCommandLineInfo(tool, "", FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL,
OUTPUT_PREFIX_VAL, OUTPUT_VAL, INPUTS_ARRAY_VAL, null);
assertNotNull(info);
assertEquals(FLAGS_VAL + " " + OUTPUT_FLAG_VAL + " " + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"" + " " + "\""
+ INPUTS_VAL + "\"", info.getCommandLine());
+ INPUTS_VAL + "\" " + EXTRA_FLAGS, info.getCommandLine());
info = gen.generateCommandLineInfo(null, COMMAND_VAL, new String[0], OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
info = gen.generateCommandLineInfo(tool, COMMAND_VAL, new String[0], OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
OUTPUT_VAL, INPUTS_ARRAY_VAL, null);
assertNotNull(info);
assertEquals(COMMAND_VAL + " " + OUTPUT_FLAG_VAL + " " + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"" + " "
+ "\"" + INPUTS_VAL + "\"", info.getCommandLine());
+ "\"" + INPUTS_VAL + "\" " + EXTRA_FLAGS, info.getCommandLine());
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, "", OUTPUT_PREFIX_VAL, OUTPUT_VAL,
info = gen.generateCommandLineInfo(tool, COMMAND_VAL, FLAGS_ARRAY_VAL, "", OUTPUT_PREFIX_VAL, OUTPUT_VAL,
INPUTS_ARRAY_VAL, null);
assertNotNull(info);
assertEquals(COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL + "\"" + " " + "\""
+ INPUTS_VAL + "\"", info.getCommandLine());
+ INPUTS_VAL + "\" " + EXTRA_FLAGS, info.getCommandLine());
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, "", OUTPUT_VAL,
info = gen.generateCommandLineInfo(tool, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, "", OUTPUT_VAL,
INPUTS_ARRAY_VAL, null);
assertNotNull(info);
assertEquals(COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + " " + "\"" + OUTPUT_VAL + "\"" + " " + "\""
+ INPUTS_VAL + "\"", info.getCommandLine());
+ INPUTS_VAL + "\" " + EXTRA_FLAGS, info.getCommandLine());
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, "",
info = gen.generateCommandLineInfo(tool, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, "",
INPUTS_ARRAY_VAL, null);
assertNotNull(info);
assertEquals(COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + " " + OUTPUT_PREFIX_VAL + " " + "\""
+ INPUTS_VAL + "\"", info.getCommandLine());
+ INPUTS_VAL + "\" " + EXTRA_FLAGS, info.getCommandLine());
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
info = gen.generateCommandLineInfo(tool, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
OUTPUT_VAL, new String[0], null);
assertNotNull(info);
assertEquals(COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + " " + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL
+ "\"", info.getCommandLine());
+ "\" " + EXTRA_FLAGS, info.getCommandLine());
info = gen.generateCommandLineInfo(null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
info = gen.generateCommandLineInfo(tool, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL,
OUTPUT_VAL, null, null);
assertNotNull(info);
assertEquals(COMMAND_VAL + " " + FLAGS_VAL + " " + OUTPUT_FLAG_VAL + " " + OUTPUT_PREFIX_VAL + "\"" + OUTPUT_VAL
+ "\"", info.getCommandLine());
+ "\" " + EXTRA_FLAGS, info.getCommandLine());
}
public final void testCustomGenerator() {
@ -332,9 +347,13 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
String[] libs = config.getLibs(config.getArtifactExtension());
assertEquals(Arrays.asList("-optLibs=\"val4;COCG2;\"").toString(), Arrays.asList(libs).toString());
assertEquals(Arrays.asList(libs).toString(),
Arrays.asList(tool.getExtraFlags(IOption.LIBRARIES)).toString());
String[] userObjs = config.getUserObjects(config.getArtifactExtension());
assertEquals(Arrays.asList("-optUserObjs=\"val5;COCG2;\"").toString(), Arrays.asList(userObjs).toString());
assertEquals(Arrays.asList(userObjs).toString(),
Arrays.asList(tool.getExtraFlags(IOption.OBJECTS)).toString());
ManagedBuildTestHelper.removeProject("COCG2");
} catch (Exception e) {
@ -401,4 +420,12 @@ public class ManagedCommandLineGeneratorTest extends TestCase {
}
}
private void setToolOptionByType(ITool tool, int valueType, String[] value) throws BuildException {
for (IOption option : tool.getOptions()) {
if (valueType == option.getValueType()) {
option.setValue(value);
}
}
}
}

View file

@ -248,8 +248,8 @@ public class ManagedProject21MakefileTests extends TestCase {
* tests 2.1 style tool integration for a single file executable
*/
public void testSingleFileExe() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("singleFileExe", null, null, true);
buildProjects("singleFileExe", projects, makefiles);
}
@ -258,8 +258,8 @@ public class ManagedProject21MakefileTests extends TestCase {
* tests 2.1 style tool integration for a two file SO
*/
public void testTwoFileSO() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("twoFileSO", null, null, true);
buildProjects("twoFileSO", projects, makefiles);
}
@ -268,8 +268,8 @@ public class ManagedProject21MakefileTests extends TestCase {
* tests 2.1 style tool integration for multiple source files & a resource configuration
*/
public void testMultiResConfig() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), Path.fromOSString("source1/subdir.mk"),
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("source1/subdir.mk"),
Path.fromOSString("source2/subdir.mk"), Path.fromOSString("source2/source21/subdir.mk") };
IProject[] projects = createProjects("multiResConfig", null, null, true);
buildProjects("multiResConfig", projects, makefiles);
@ -280,7 +280,7 @@ public class ManagedProject21MakefileTests extends TestCase {
*/
public void testLinkedLib() throws IOException {
boolean succeeded = false;
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
IPath[] makefiles = { Path.fromOSString("makefile"),
//Path.fromOSString("subdir.mk") // Can't compare this yet since it contains absolute paths!
Path.fromOSString("sources.mk") };
IPath[] linkedFiles = { Path.fromOSString("f1.c"), Path.fromOSString("f2.c"), Path.fromOSString("test_ar.h") };
@ -309,11 +309,11 @@ public class ManagedProject21MakefileTests extends TestCase {
*/
public void testLinkedFolder() throws IOException {
boolean succeeded = false;
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("sources.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("subdir.mk"),
Path.fromOSString("sources.mk") };
IPath[] linkedFiles = { Path.fromOSString("f1.c"), Path.fromOSString("f2.c"), Path.fromOSString("test_ar.h"),
Path.fromOSString("Benchmarks/makefile"), Path.fromOSString("Benchmarks/objects.mk"),
Path.fromOSString("Benchmarks/subdir.mk"), Path.fromOSString("Benchmarks/sources.mk") };
Path.fromOSString("Benchmarks/makefile"), Path.fromOSString("Benchmarks/subdir.mk"),
Path.fromOSString("Benchmarks/sources.mk") };
File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test21Projects/linkedFolder/"));
IPath srcDir = Path.fromOSString(srcDirFile.toString());
IPath tmpSubDir = Path.fromOSString("CDTMBSTest");

View file

@ -287,8 +287,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration for a single file executable
*/
public void test30SingleFileExe() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("singleFileExe", null, null, true);
buildProjects(projects, makefiles);
}
@ -297,8 +297,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration for a two file SO
*/
public void test30TwoFileSO() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("twoFileSO", null, null, true);
buildProjects(projects, makefiles);
}
@ -307,11 +307,11 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration for multiple source files & a resource configuration
*/
public void test30MultiResConfig() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), Path.fromOSString("main.d"),
Path.fromOSString("source1/subdir.mk"), Path.fromOSString("source1/Class1.d"),
Path.fromOSString("source2/subdir.mk"), Path.fromOSString("source2/Class2.d"),
Path.fromOSString("source2/source21/Class21.d"), Path.fromOSString("source2/source21/subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("main.d"), Path.fromOSString("source1/subdir.mk"),
Path.fromOSString("source1/Class1.d"), Path.fromOSString("source2/subdir.mk"),
Path.fromOSString("source2/Class2.d"), Path.fromOSString("source2/source21/Class21.d"),
Path.fromOSString("source2/source21/subdir.mk") };
IProject[] projects = createProjects("multiResConfig", null, null, true);
buildProjects(projects, makefiles);
}
@ -320,7 +320,7 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration for linked files
*/
public void test30LinkedLib() throws IOException {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
IPath[] makefiles = { Path.fromOSString("makefile"),
//Path.fromOSString("subdir.mk") // Can't compare this yet since it contains absolute paths!
Path.fromOSString("sources.mk") };
IPath[] linkedFiles = { Path.fromOSString("f1_30.c"), Path.fromOSString("f2_30.c"),
@ -348,11 +348,11 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration for a linked folder
*/
public void test30LinkedFolder() throws IOException {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("sources.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("subdir.mk"),
Path.fromOSString("sources.mk") };
IPath[] linkedFiles = { Path.fromOSString("f1.c"), Path.fromOSString("f2.c"), Path.fromOSString("test_ar.h"),
Path.fromOSString("Benchmarks/makefile"), Path.fromOSString("Benchmarks/objects.mk"),
Path.fromOSString("Benchmarks/subdir.mk"), Path.fromOSString("Benchmarks/sources.mk") };
Path.fromOSString("Benchmarks/makefile"), Path.fromOSString("Benchmarks/subdir.mk"),
Path.fromOSString("Benchmarks/sources.mk") };
File srcDirFile = CTestPlugin.getFileInPlugin(new Path("resources/test30Projects/linkedFolder/"));
IPath srcDir = Path.fromOSString(srcDirFile.toString());
IPath tmpRootDir = Path
@ -377,9 +377,9 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration with pre and post process steps added to typical compile & link
*/
public void test30CopyandDeploy() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), Path.fromOSString("main.d"),
Path.fromOSString("Functions/subdir.mk"), Path.fromOSString("Functions/Func1.d") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("main.d"), Path.fromOSString("Functions/subdir.mk"),
Path.fromOSString("Functions/Func1.d") };
IProject[] projects = createProjects("copyandDeploy", null, null, true);
buildProjects(projects, makefiles);
}
@ -389,8 +389,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* occurs in the managedbuild system
*/
public void test30DeleteFile() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("sources.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("subdir.mk"),
Path.fromOSString("sources.mk") };
IProject[] projects = createProjects("deleteFile", null, null, true);
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
@ -419,8 +419,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* "excluded from build" to see that this degenerative case is handled gracefully
*/
public void test30NoFilesToBuild() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("sources.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("subdir.mk"),
Path.fromOSString("sources.mk") };
IProject[] projects = createProjects("noFilesToBuild", null, null, true);
IProject project = projects[0];
@ -437,8 +437,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 managed build system with a project which has a file with no file extesnion
*/
public void testFileWithNoExtension() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("testFileWithNoExtension", null, null, true);
buildProjects(projects, makefiles);
}
@ -448,8 +448,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* the proper commands are generated in the makefile which is created by the managedbuild system
*/
public void testPreAndPostProcessBuildSteps() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("sources.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("subdir.mk"),
Path.fromOSString("sources.mk") };
IProject[] projects = createProjects("preAndPostBuildSteps", null, null, true);
IProject project = projects[0];
@ -467,8 +467,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* the proper commands are generated in the makefile which is created by the managedbuild system
*/
public void testResourceCustomBuildStep() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("sources.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("subdir.mk"),
Path.fromOSString("sources.mk") };
ITool rcbsTool;
IInputType rcbsToolInputType;
IAdditionalInput rcbsToolInputTypeAdditionalInput;
@ -497,8 +497,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration with pre and post process steps added to typical compile & link
*/
public void test30_1() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("test30_1", null, null, true);
buildProjects(projects, makefiles);
}
@ -507,8 +507,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests 3.0 style tool integration with multiple input types use Eclipse content types
*/
public void test30_2() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("test30_2", null, null, true);
buildProjects(projects, makefiles);
}
@ -543,8 +543,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests external dependency calculation using Fortran modules
*/
public void CDTFortranTest1() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("CDTFortranTest1", null, null, true);
buildProjects(projects, makefiles);
}
@ -553,9 +553,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests external dependency calculation using Fortran modules
*/
public void CDTFortranTest2() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("module/subdir.mk"),
Path.fromOSString("Sources/subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("module/subdir.mk"), Path.fromOSString("Sources/subdir.mk") };
IProject[] projects = createProjects("CDTFortranTest2", null, null, true);
buildProjects(projects, makefiles);
}
@ -564,15 +563,15 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests the InputType assignToOption attribute
*/
public void TestATO() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("TestATO", null, null, true);
buildProjects(projects, makefiles);
}
public void testMacroSupportInBuildDefinitions() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
IProject[] projects = createProjects("testMacroSupportInBuildDefinitions", null, null, true);
buildProjects(projects, makefiles);
}
@ -582,9 +581,9 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests managed build system with a project which has resources with spaces in their paths
*/
public void testSpaces() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"),
Path.fromOSString("main with spaces.d"), Path.fromOSString("sub folder with spaces/subdir.mk"),
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("main with spaces.d"),
Path.fromOSString("sub folder with spaces/subdir.mk"),
Path.fromOSString("sub folder with spaces/foo with spaces.d") };
IProject[] projects = createProjects("test with spaces", null, null, true);
buildProjects(projects, makefiles);
@ -595,8 +594,8 @@ public class ManagedProject30MakefileTests extends TestCase {
* tests managed build system with a project which has resources with spaces in their paths
*/
public void testInputTypeOption() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"), };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"), };
IProject[] projects = createProjects("inputTypeOption", null, null, true);
buildProjects(projects, makefiles);
}

View file

@ -209,8 +209,8 @@ public class ManagedProjectUpdateTests extends TestCase {
* in case when user chooses to update the project
*/
public void testProjectUpdate12_Update() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
doTestProjectUpdate("1.2", true, true, makefiles);
}
@ -219,8 +219,8 @@ public class ManagedProjectUpdateTests extends TestCase {
* in case when user chooses to update the project
*/
public void testProjectUpdate20_Update() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk") };
doTestProjectUpdate("2.0", true, true, makefiles);
}
@ -229,9 +229,8 @@ public class ManagedProjectUpdateTests extends TestCase {
* in case when user chooses to update the project
*/
public void testProjectUpdate21_Update() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"),
Path.fromOSString("Functions/subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("Functions/subdir.mk") };
doTestProjectUpdate("2.1", true, true, makefiles);
}
@ -239,9 +238,8 @@ public class ManagedProjectUpdateTests extends TestCase {
* tests project v2.1 update of a C++ project with C source files
*/
public void testProjectUpdate21CPP_Update() {
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("objects.mk"),
Path.fromOSString("sources.mk"), Path.fromOSString("subdir.mk"),
Path.fromOSString("Functions/subdir.mk") };
IPath[] makefiles = { Path.fromOSString("makefile"), Path.fromOSString("sources.mk"),
Path.fromOSString("subdir.mk"), Path.fromOSString("Functions/subdir.mk") };
doTestProjectUpdate("2.1CPP", true, true, makefiles);
}

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
Bundle-Version: 9.3.400.qualifier
Bundle-Version: 9.4.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -714,4 +714,11 @@ public interface ITool extends IHoldsOptions {
void setHidden(boolean hidden);
String getUniqueRealName();
/**
* @since 9.4
*/
default public String[] getExtraFlags(int optionType) {
return new String[0];
}
}

View file

@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.core;
import java.util.stream.Stream;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
/**
@ -29,6 +31,7 @@ public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator
private static final String OUTPUT_PREFIX_PRM_NAME = "OUTPUT_PREFIX"; //$NON-NLS-1$
private static final String OUTPUT_PRM_NAME = "OUTPUT"; //$NON-NLS-1$
private static final String INPUTS_PRM_NAME = "INPUTS"; //$NON-NLS-1$
private static final String EXTRA_FLAGS_PRM_NAME = "EXTRA_FLAGS"; //$NON-NLS-1$
private String makeVariable(String variableName) {
return "${" + variableName + "}"; //$NON-NLS-1$ //$NON-NLS-2$
@ -65,12 +68,21 @@ public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator
String command = commandLinePattern;
// Workaround GNU ld limitation that requires additional objects and libraries to be last on command line
String[] extraFlags = mergeArrays(tool.getExtraFlags(IOption.OBJECTS), tool.getExtraFlags(IOption.LIBRARIES));
String extraFlagsStr = stringArrayToString(extraFlags);
// Need to update "flags" in order to make the change visible outside the makefile generator.
// NOTE: Do not update the flagsStr as it would render the options listed twice!
flags = mergeArrays(flags, extraFlags);
command = command.replace(makeVariable(CMD_LINE_PRM_NAME), commandName);
command = command.replace(makeVariable(FLAGS_PRM_NAME), flagsStr);
command = command.replace(makeVariable(OUTPUT_FLAG_PRM_NAME), outputFlag);
command = command.replace(makeVariable(OUTPUT_PREFIX_PRM_NAME), outputPrefix);
command = command.replace(makeVariable(OUTPUT_PRM_NAME), outputName);
command = command.replace(makeVariable(INPUTS_PRM_NAME), inputsStr);
command = command.replace(makeVariable(EXTRA_FLAGS_PRM_NAME), extraFlagsStr);
command = command.replace(makeVariable(CMD_LINE_PRM_NAME.toLowerCase()), commandName);
command = command.replace(makeVariable(FLAGS_PRM_NAME.toLowerCase()), flagsStr);
@ -78,6 +90,7 @@ public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator
command = command.replace(makeVariable(OUTPUT_PREFIX_PRM_NAME.toLowerCase()), outputPrefix);
command = command.replace(makeVariable(OUTPUT_PRM_NAME.toLowerCase()), outputName);
command = command.replace(makeVariable(INPUTS_PRM_NAME.toLowerCase()), inputsStr);
command = command.replace(makeVariable(EXTRA_FLAGS_PRM_NAME.toLowerCase()), extraFlagsStr);
return toManagedCommandLineInfo(tool, command.trim(), commandLinePattern, commandName, flags, outputFlag,
outputPrefix, outputName, inputResources);
@ -148,4 +161,8 @@ public class ManagedCommandLineGenerator implements IManagedCommandLineGenerator
}
return String.join(WHITESPACE, array);
}
private String[] mergeArrays(String[]... arrays) {
return Stream.of(arrays).flatMap(Stream::of).toArray(String[]::new);
}
}

View file

@ -74,6 +74,8 @@ import org.eclipse.cdt.managedbuilder.internal.macros.BuildfileMacroSubstitutor;
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
import org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo;
import org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfoProvider;
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
@ -103,7 +105,7 @@ import org.osgi.framework.Version;
public class Tool extends HoldsOptions
implements ITool, IOptionCategory, IMatchKeyProvider<Tool>, IRealBuildObjectAssociation {
public static final String DEFAULT_PATTERN = "${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}"; //$NON-NLS-1$
public static final String DEFAULT_PATTERN = "${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${EXTRA_FLAGS}"; //$NON-NLS-1$
public static final String DEFAULT_CBS_PATTERN = "${COMMAND}"; //$NON-NLS-1$
//property name for holding the rebuild state
@ -4251,4 +4253,102 @@ public class Tool extends HoldsOptions
// Tool does not have any ApplicabilityCalculator.
return null;
}
@Override
public String[] getExtraFlags(int optionType) {
if (optionType != IOption.LIBRARIES && optionType != IOption.OBJECTS) {
// Early exit to avoid performance penalty
return new String[0];
}
Vector<String> flags = new Vector<>();
for (IOption option : getOptions()) {
try {
if (option.getValueType() != optionType) {
continue;
}
// check to see if the option has an applicability calculator
IOptionApplicability applicabilityCalculator = option.getApplicabilityCalculator();
if (applicabilityCalculator == null
|| applicabilityCalculator.isOptionUsedInCommandLine(this, this, option)) {
boolean generateDefaultCommand = true;
IOptionCommandGenerator commandGenerator = option.getCommandGenerator();
if (commandGenerator != null) {
SupplierBasedCdtVariableSubstitutor macroSubstitutor = new BuildfileMacroSubstitutor(null,
EMPTY_STRING, WHITE_SPACE);
IMacroContextInfoProvider provider = BuildMacroProvider.getDefault();
IMacroContextInfo info = provider.getMacroContextInfo(BuildMacroProvider.CONTEXT_OPTION,
new OptionContextData(option, this));
if (info != null) {
macroSubstitutor.setMacroContextInfo(info);
String command = commandGenerator.generateCommand(option, macroSubstitutor);
if (command != null) {
flags.add(command);
generateDefaultCommand = false;
}
}
}
if (generateDefaultCommand) {
switch (optionType) {
case IOption.LIBRARIES: {
String command = option.getCommand();
String[] libs = option.getLibraries();
for (String lib : libs) {
try {
String resolved[] = ManagedBuildManager.getBuildMacroProvider()
.resolveStringListValueToMakefileFormat(lib, " ", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_OPTION,
new OptionContextData(option, this));
if (resolved != null && resolved.length > 0) {
for (String string : resolved) {
if (!string.isEmpty()) {
flags.add(command + string);
}
}
}
} catch (BuildMacroException e) {
// TODO: report error
continue;
}
}
break;
}
case IOption.OBJECTS: {
String userObjs[] = option.getUserObjects();
if (userObjs != null && userObjs.length > 0) {
for (String userObj : userObjs) {
try {
String resolved[] = ManagedBuildManager.getBuildMacroProvider()
.resolveStringListValueToMakefileFormat(userObj, "", //$NON-NLS-1$
" ", //$NON-NLS-1$
IBuildMacroProvider.CONTEXT_OPTION,
new OptionContextData(option, this));
if (resolved != null && resolved.length > 0) {
flags.addAll(Arrays.asList(resolved));
}
} catch (BuildMacroException e) {
// TODO: report error
continue;
}
}
}
break;
}
default:
// Cannot happen
break;
}
}
}
} catch (BuildException | CdtVariableException e) {
// TODO: report error
continue;
}
}
return flags.toArray(new String[flags.size()]);
}
}

View file

@ -44,6 +44,8 @@ import java.util.TreeSet;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.settings.model.CSourceEntry;
@ -972,12 +974,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
populateTopMakefile(makefileHandle, true);
checkCancel();
// Now finish up by adding all the object files
IPath objFilePath = topBuildDir.append(OBJECTS_MAKFILE);
IFile objsFileHandle = createFile(objFilePath);
populateObjectsMakefile(objsFileHandle);
checkCancel();
// How did we do
if (!getInvalidDirList().isEmpty()) {
status = new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.WARNING, "", //$NON-NLS-1$
@ -1029,67 +1025,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
save(makeBuf, modMakefile);
}
/**
* The makefile generator generates a Macro for each type of output, other than final artifact,
* created by the build.
*
* @param fileHandle The file that should be populated with the output
*/
protected void populateObjectsMakefile(IFile fileHandle) throws CoreException {
// Master list of "object" dependencies, i.e. dependencies between input files and output files.
StringBuffer macroBuffer = new StringBuffer();
List<String> valueList;
macroBuffer.append(addGenericHeader());
// Map of macro names (String) to its definition (List of Strings)
HashMap<String, List<String>> outputMacros = new HashMap<>();
// Add the predefined LIBS, USER_OBJS macros
// Add the libraries this project depends on
valueList = new ArrayList<>();
String[] libs = config.getLibs(buildTargetExt);
for (String lib : libs) {
valueList.add(lib);
}
outputMacros.put("LIBS", valueList); //$NON-NLS-1$
// Add the extra user-specified objects
valueList = new ArrayList<>();
String[] userObjs = config.getUserObjects(buildTargetExt);
for (String obj : userObjs) {
valueList.add(obj);
}
outputMacros.put("USER_OBJS", valueList); //$NON-NLS-1$
// Write every macro to the file
for (Entry<String, List<String>> entry : outputMacros.entrySet()) {
macroBuffer.append(entry.getKey()).append(" :="); //$NON-NLS-1$
valueList = entry.getValue();
for (String path : valueList) {
// These macros will also be used within commands.
// Make all the slashes go forward so they aren't
// interpreted as escapes and get lost.
// See https://bugs.eclipse.org/163672.
path = path.replace('\\', '/');
path = ensurePathIsGNUMakeTargetRuleCompatibleSyntax(path);
macroBuffer.append(WHITESPACE);
macroBuffer.append(path);
}
// terminate the macro definition line
macroBuffer.append(NEWLINE);
// leave a blank line before the next macro
macroBuffer.append(NEWLINE);
}
// For now, just save the buffer that was populated when the rules were created
save(macroBuffer, fileHandle);
}
protected void populateSourcesMakefile(IFile fileHandle) throws CoreException {
// Add the comment
StringBuffer buffer = addGenericHeader();
@ -1268,8 +1203,6 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
buffer.append(MODFILE_NAME).append(NEWLINE);
}
buffer.append("-include objects.mk").append(NEWLINE).append(NEWLINE); //$NON-NLS-1$
// Include generated dependency makefiles if non-empty AND a "clean" has not been requested
if (!buildDepVars.isEmpty()) {
buffer.append("ifneq ($(MAKECMDGOALS),clean)").append(NEWLINE); //$NON-NLS-1$
@ -1763,9 +1696,16 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
}
buildRule += calculatedDependencies;
buildRule += WHITESPACE + MAKEFILE_NAME; // makefile itself
buildRule += WHITESPACE + OBJECTS_MAKFILE; // objects.mk
buildRule += WHITESPACE + "$(OPTIONAL_TOOL_DEPS)"; //$NON-NLS-1$ // Optional dep to generated makefile extension files
// Depend on additional object files for the tool, if any
String[] additionalObjects = tool.getExtraFlags(IOption.OBJECTS);
if (additionalObjects.length > 0) {
buildRule += WHITESPACE + Stream.of(additionalObjects) //
.map(this::ensurePathIsGNUMakeTargetRuleCompatibleSyntax) //
.collect(Collectors.joining(WHITESPACE));
}
// We can't have duplicates in a makefile
if (getRuleList().contains(buildRule)) {
} else {
@ -1797,8 +1737,17 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
}
String[] cmdInputs = inputs.toArray(new String[inputs.size()]);
IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
String commandLinePattern = tool.getCommandLinePattern();
if (!commandLinePattern.contains("${EXTRA_FLAGS}")) { //$NON-NLS-1$
String[] objs = tool.getExtraFlags(IOption.OBJECTS);
String[] libs = tool.getExtraFlags(IOption.LIBRARIES);
if (objs.length > 0 || libs.length > 0) {
// Tool command line pattern would expect legacy "$(USER_OBJS)" or "$(LIBS)" make-symbols to be appended.
commandLinePattern = commandLinePattern + " ${EXTRA_FLAGS}"; //$NON-NLS-1$
}
}
IManagedCommandLineInfo cmdLInfo = gen.generateCommandLineInfo(tool, command, flags, outflag, outputPrefix,
primaryOutputs, cmdInputs, tool.getCommandLinePattern());
primaryOutputs, cmdInputs, commandLinePattern);
// The command to build
String buildCmd = null;