Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorbjörn SVENSSON2021-02-19 12:48:24 -0500
committerTorbjörn Svensson2021-05-24 09:52:20 -0400
commitfcbf0b69634181ac3124e1cdd98e80a10e46e086 (patch)
treee86d6831dbb1250ad7ac0c97512693f2f29e7adf /build/org.eclipse.cdt.managedbuilder.core/src/org
parent6187228a0866b3b3f98b4860bca979544843871f (diff)
downloadorg.eclipse.cdt-fcbf0b69634181ac3124e1cdd98e80a10e46e086.tar.gz
org.eclipse.cdt-fcbf0b69634181ac3124e1cdd98e80a10e46e086.tar.xz
org.eclipse.cdt-fcbf0b69634181ac3124e1cdd98e80a10e46e086.zip
Bug 573722: Allow sub-class to output custom lines in header
Contributed by STMicroelectronics Change-Id: If7163f33c804dc40bc950da067d81396a26d8f74 Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core/src/org')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java13
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java47
2 files changed, 55 insertions, 5 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
index dc3d5bb4419..d800377b861 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
@@ -97,12 +97,21 @@ public class DefaultGCCDependencyCalculator3 implements IManagedDependencyGenera
makefile = root.getFile(makefilePath);
IResourceInfo rcInfo = tool.getParentResourceInfo();
if (rcInfo != null)
- return GnuMakefileGenerator.populateDummyTargets(rcInfo, makefile, false);
- return GnuMakefileGenerator.populateDummyTargets(buildContext, makefile, false);
+ return createMakefileGenerator().generateDummyTargets(rcInfo, makefile, false);
+ return createMakefileGenerator().generateDummyTargets(buildContext, makefile, false);
} catch (CoreException e) {
} catch (IOException e) {
}
return false;
}
+ /**
+ * Return a GnuMakefileGenerator instance to use during post processing of dependency files
+ * @return an GnuMakefileGenerator instance
+ * @since 9.3
+ */
+ protected GnuMakefileGenerator createMakefileGenerator() {
+ return new GnuMakefileGenerator();
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
index 0975ea60dce..9627354693d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
@@ -106,6 +106,9 @@ import org.eclipse.core.runtime.SubProgressMonitor;
/**
* This is a specialized makefile generator that takes advantage of the
* extensions present in Gnu Make.
+ * <p>
+ * If sub-classing and using {@link DefaultGCCDependencyCalculator3}, make sure to also override
+ * {@link DefaultGCCDependencyCalculator3#createMakefileGenerator()} to return the appropriate result.
*
* @since 1.2
* @noinstantiate This class is not intended to be instantiated by clients.
@@ -3483,6 +3486,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
}
/**
+ * @deprecated Use {@link GnuMakefileGenerator#generateDummyTargets(IConfiguration, IFile, boolean)}
+ */
+ @Deprecated
+ static public boolean populateDummyTargets(IConfiguration cfg, IFile makefile, boolean force)
+ throws CoreException, IOException {
+ return new GnuMakefileGenerator().generateDummyTargets(cfg, makefile, force);
+ }
+
+ /**
* This method postprocesses a .d file created by a build.
* It's main job is to add dummy targets for the header files dependencies.
* This prevents make from aborting the build if the header file does not exist.
@@ -3495,14 +3507,27 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
* checks for to determine if this dependency file has already been updated.
*
* @return a <code>true</code> if the dependency file is modified
+ * @since 9.3
*/
- static public boolean populateDummyTargets(IConfiguration cfg, IFile makefile, boolean force)
+ public boolean generateDummyTargets(IConfiguration cfg, IFile makefile, boolean force)
throws CoreException, IOException {
- return populateDummyTargets(cfg.getRootFolderInfo(), makefile, force);
+ return generateDummyTargets(cfg.getRootFolderInfo(), makefile, force);
}
+ /**
+ * @deprecated Use {@link GnuMakefileGenerator#generateDummyTargets(IResourceInfo, IFile, boolean)}
+ */
+ @Deprecated
static public boolean populateDummyTargets(IResourceInfo rcInfo, IFile makefile, boolean force)
throws CoreException, IOException {
+ return new GnuMakefileGenerator().generateDummyTargets(rcInfo, makefile, force);
+ }
+
+ /**
+ * @since 9.3
+ */
+ public boolean generateDummyTargets(IResourceInfo rcInfo, IFile makefile, boolean force)
+ throws CoreException, IOException {
if (makefile == null || !makefile.exists())
return false;
@@ -3696,22 +3721,38 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
static public String ECHO_BLANK_LINE = ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE;
/**
+ * @deprecated Use {@link GnuMakefileGenerator#addGenericHeader()}
+ */
+ @Deprecated
+ static protected StringBuffer addDefaultHeader() {
+ return new GnuMakefileGenerator().addGenericHeader();
+ }
+
+ /**
* Outputs a comment formatted as follows:
* ##### ....... #####
* # <Comment message>
* ##### ....... #####
+ * @since 9.3
*/
- static protected StringBuffer addDefaultHeader() {
+ protected StringBuffer addGenericHeader() {
StringBuffer buffer = new StringBuffer();
outputCommentLine(buffer);
buffer.append(COMMENT_SYMBOL).append(WHITESPACE).append(ManagedMakeMessages.getResourceString(HEADER))
.append(NEWLINE);
+ addCustomHeader(buffer);
outputCommentLine(buffer);
buffer.append(NEWLINE);
return buffer;
}
/**
+ * @since 9.3
+ */
+ protected void addCustomHeader(StringBuffer buffer) {
+ }
+
+ /**
* Put COLS_PER_LINE comment charaters in the argument.
*/
static protected void outputCommentLine(StringBuffer buffer) {

Back to the top