Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDoug Schaefer2003-07-25 17:31:01 +0000
committerDoug Schaefer2003-07-25 17:31:01 +0000
commit3a2ed3957a53250c08f7c378f74506da58999e8a (patch)
treeff12cd8c2dc592e85b11bbf4e960f340c093b127 /core
parent1be03f5cfc276d79dfbae867efe75e8e84276328 (diff)
downloadorg.eclipse.cdt-3a2ed3957a53250c08f7c378f74506da58999e8a.tar.gz
org.eclipse.cdt-3a2ed3957a53250c08f7c378f74506da58999e8a.tar.xz
org.eclipse.cdt-3a2ed3957a53250c08f7c378f74506da58999e8a.zip
Patch for Sean Evoy:
- I added the ability to build when there are inter-project dependencies (first iteration; I would like to try another way). There is also some changes to how libraries are handled. Change logs describe the changes and the AllBuildTests has been updated to reflect these changes.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java32
-rw-r--r--core/org.eclipse.cdt.core.tests/plugin.xml4
-rw-r--r--core/org.eclipse.cdt.core/ChangeLog54
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java25
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java9
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java17
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java68
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java19
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java20
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java26
-rw-r--r--core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java15
-rw-r--r--core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd21
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/MakefileGenerator.java57
-rw-r--r--core/org.eclipse.cdt.ui/ChangeLog10
-rw-r--r--core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java2
-rw-r--r--core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java9
-rw-r--r--core/org.eclipse.cdt.ui/plugin.xml25
17 files changed, 369 insertions, 44 deletions
diff --git a/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java b/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
index 593e1173ed1..a971fe8e819 100644
--- a/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
+++ b/core/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
@@ -528,20 +528,12 @@ public class AllBuildTests extends TestCase {
tools = rootConfig.getTools();
assertEquals(1, tools.length);
assertEquals("Root Tool", tools[0].getName());
- topCategory = tools[0].getTopOptionCategory();
- options = topCategory.getOptions(configs[0]);
- assertEquals(2, options.length);
- assertEquals("List Option in Top", options[0].getName());
- valueList = options[0].getStringListValue();
- assertEquals("a", valueList[0]);
- assertEquals("b", valueList[1]);
- assertEquals("Boolean Option in Top", options[1].getName());
- categories = topCategory.getChildCategories();
- options = categories[0].getOptions(configs[0]);
- assertEquals(2, options.length);
- assertEquals("String Option in Category", options[0].getName());
- assertEquals(oicValue, options[0].getStringValue());
- assertEquals("Enumerated Option in Category", options[1].getName());
+ assertEquals("-r", tools[0].getOutputFlag());
+ assertTrue(tools[0].buildsFileType("foo"));
+ assertTrue(tools[0].buildsFileType("bar"));
+ assertTrue(tools[0].producesFileType("toor"));
+ assertEquals("doIt", tools[0].getToolCommand());
+ assertEquals("", tools[0].getOutputPrefix());
// Root Override Config
assertEquals("Root Override Config", configs[1].getName());
@@ -569,6 +561,13 @@ public class AllBuildTests extends TestCase {
assertEquals("Another Enum", valueList[1]);
assertEquals("-e1", options[1].getEnumCommand(valueList[0]));
assertEquals("-e2", options[1].getEnumCommand(valueList[1]));
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ assertEquals("-r", tools[0].getOutputFlag());
+ assertTrue(tools[0].buildsFileType("foo"));
+ assertTrue(tools[0].buildsFileType("bar"));
+ assertTrue(tools[0].producesFileType("toor"));
+ assertEquals("doIt", tools[0].getToolCommand());
}
/*
@@ -595,6 +594,11 @@ public class AllBuildTests extends TestCase {
// Confirm that it has three options
IOption[] subOpts = subTool.getOptions();
assertEquals(3, subOpts.length);
+ assertEquals("", subTool.getOutputFlag());
+ assertTrue(subTool.buildsFileType("yarf"));
+ assertTrue(subTool.producesFileType("bus"));
+ assertEquals("", subTool.getToolCommand());
+ assertEquals("lib", subTool.getOutputPrefix());
// Do a sanity check on the options
assertEquals("Include Paths", subOpts[0].getName());
diff --git a/core/org.eclipse.cdt.core.tests/plugin.xml b/core/org.eclipse.cdt.core.tests/plugin.xml
index f8e3062c079..6fed9577df1 100644
--- a/core/org.eclipse.cdt.core.tests/plugin.xml
+++ b/core/org.eclipse.cdt.core.tests/plugin.xml
@@ -35,6 +35,7 @@
<tool
sources="foo,bar"
name="Root Tool"
+ outputFlag="-r"
outputs="toor"
command="doIt"
id="root.tool">
@@ -119,7 +120,10 @@
id="sub.config">
</configuration>
<tool
+ sources="yarf"
name="Sub Tool"
+ outputPrefix="lib"
+ outputs="bus"
id="tool.sub">
<option
name="Include Paths"
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 2bb1ace8244..1b5a2573c50 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,3 +1,57 @@
+2003-07-24 Sean Evoy
+ *src/org/eclipse/cdt/internal/core/MakefileGenerator.java:
+ Added code to place interproject dependencies in target build rule,
+ added code to properly put output prefixes on library names, and
+ added code to put library link arguments at the end of the depednency list
+
+ * build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
+ * build/org/eclipse/cdt/core/build/managed/IOption.java
+ * build/org/eclipse/cdt/core/build/managed/ITool.java
+ * build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
+ * build/org/eclipse/cdt/internal/core/build/managed/Option.java
+ * build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
+ * build/org/eclipse/cdt/internal/core/build/managed/Tool.java
+ * build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java:
+ Added code to managed output prefixes for tools like the librarian. Added code
+ to manage the library options differently. Removed some hard-coding of tool
+ information, such as the output flag.
+
+ *schema/ManagedBuildTools.exsd:
+ New attributes on tool for output flag and prefix. New value type enum for option
+ to handle libs differently.
+
+2003-07-24 Sean Evoy
+ Changes introduced to make the managed build system work with
+ multi-folder project.
+
+ * src/org/eclipse/cdt/core/ManagedCProjectNature.java:
+ now removes the cbuilder from a project before it adds its
+ own builder. This is a temporary fix to stop the managed build
+ system from building a project twice. When the new StandardBuildNature
+ is introduced, this code will be removed.
+
+ * src/org/eclipse/cdt/internal/core/CCorePluginResources.properties:
+ New builder messages added.
+
+ * src/org/eclipse/cdt/internal/core/GeneratedMakefileBuilder.java:
+ Moved the actual directory and file creation to a delegate class.
+
+ * src/org/eclipse/cdt/internal/core/MakefileGenerator.java:
+ New class that does the grunt work of creating build output directories
+ and makefiles.
+
+ * build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java:
+ Short-term changes to make it possible for build info clients to get the
+ path and symbol information. When a permanent mechanism is implemented
+ for clients to discover this information, these methods (IScannerInfoxxx)
+ will be removed.
+
+ * build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
+ * build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java:
+ Some minor changes have been made to extract more information from the
+ build model. Currently, the values are hard-coded to simplify some integration
+ testing. This will be addressed in the next patch.
+
2003-07-24 Alain Magloire
* utils/org/eclipse/cdt/utils/Elf.java:
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
index baf3146f5c8..dd3640b0d65 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IManagedBuildInfo.java
@@ -80,12 +80,13 @@ public interface IManagedBuildInfo {
/**
* Answers the flag to be passed to the build tool to produce a specific output
* or an empty <code>String</code> if there is no special flag. For example, the
- * GCC tools use the -o flag to produce a named output, for example
+ * GCC tools use the '-o' flag to produce a named output, for example
* gcc -c foo.c -o foo.o
*
+ * @param outputExt
* @return
*/
- public String getOutputFlag();
+ public String getOutputFlag(String outputExt);
/**
* Get the target specified in the argument.
@@ -96,6 +97,16 @@ public interface IManagedBuildInfo {
public ITarget getTarget(String id);
/**
+ * Answers the prefix that should be prepended to the name of the build
+ * artifact. For example, a library foo, should have the prefix 'lib' and
+ * the extension '.a', so the final goal would be 'libfoo.a'
+ *
+ * @param extension
+ * @return
+ */
+ public String getOutputPrefix(String outputExtension);
+
+ /**
* Get all of the targets associated with the receiver.
*
* @return
@@ -123,6 +134,14 @@ public interface IManagedBuildInfo {
public String getFlagsForTarget(String extension);
/**
+ * Answers the libraries the project links in.
+ *
+ * @param extension
+ * @return
+ */
+ public String[] getLibsForTarget(String extension);
+
+ /**
* Answers a string array containing the arguments to be passed to
* make. For example, if the user has selected a build that stops
* at the first error, the array would contain {"k"}.
@@ -170,6 +189,4 @@ public interface IManagedBuildInfo {
*/
public void setDefaultTarget(ITarget target);
-
-
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
index 2e442ea3dd5..c4042236d27 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java
@@ -21,6 +21,7 @@ public interface IOption extends IBuildObject {
public static final int STRING_LIST = 3;
public static final int INCLUDE_PATH = 4;
public static final int PREPROCESSOR_SYMBOLS = 5;
+ public static final int LIBRARIES = 6;
/**
* If this option is defined as an enumeration, this function returns
@@ -81,6 +82,13 @@ public interface IOption extends IBuildObject {
/**
+ * Answers an array or <code>String</code>s containing the libraries
+ * that must be linked into the project.
+ * @return
+ */
+ public String[] getLibraries() throws BuildException ;
+
+ /**
* Answers a <code>String</code> containing the selected enumeration in an
* enumerated option. For an option that has not been changed by the user,
* the receiver will answer with the default defined in the plugin manifest.
@@ -121,4 +129,5 @@ public interface IOption extends IBuildObject {
* @return
*/
public int getValueType();
+
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
index 89751c5d8ef..e7cef1c63c9 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java
@@ -48,6 +48,22 @@ public interface ITool extends IBuildObject {
public String getOutputExtension(String inputExtension);
/**
+ * Answers the argument that must be passed to a specific tool in order to
+ * control the name of the output artifact. For example, the GCC compile and
+ * linker use '-o', while the archiver does not.
+ *
+ * @return
+ */
+ public String getOutputFlag();
+
+ /**
+ * Answers the prefix that the tool should prepend to the name of the build artifact.
+ * For example, a librarian usually prepends 'lib' to the target.a
+ * @return
+ */
+ public String getOutputPrefix();
+
+ /**
* Return the target that defines this tool, if applicable
* @return
*/
@@ -85,5 +101,6 @@ public interface ITool extends IBuildObject {
* @return
*/
public boolean producesFileType(String outputExtension);
+
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
index 3f6f451d67d..4aa43626f60 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ManagedBuildInfo.java
@@ -229,6 +229,40 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getLibsForTarget(java.lang.String)
+ */
+ public String[] getLibsForTarget(String extension) {
+ ArrayList libs = new ArrayList();
+ // Get all the tools for the current config
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ if (tool.producesFileType(extension)) {
+ IOption[] opts = tool.getOptions();
+ // Look for the lib option type
+ for (int i = 0; i < opts.length; i++) {
+ IOption option = opts[i];
+ if (option.getValueType() == IOption.LIBRARIES) {
+ try {
+ String command = option.getCommand();
+ String[] allLibs = option.getLibraries();
+ for (int j = 0; j < allLibs.length; j++) {
+ String string = allLibs[j];
+ libs.add(command + string);
+ }
+ } catch (BuildException e) {
+ continue;
+ }
+ }
+ }
+ }
+ }
+ libs.trimToSize();
+ return (String[])libs.toArray(new String[libs.size()]);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getMakeArguments()
*/
public String[] getMakeArguments() {
@@ -266,10 +300,35 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputFlag()
*/
- public String getOutputFlag() {
- // TODO Stop hard-coding this
- String flag = new String("-o");
- return flag;
+ public String getOutputFlag(String outputExt) {
+ // Get all the tools for the current config
+ String flags = new String();
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ if (tool.producesFileType(outputExt)) {
+ flags = tool.getOutputFlag();
+ }
+ }
+ return flags;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputPrefix(java.lang.String)
+ */
+ public String getOutputPrefix(String outputExtension) {
+ // Get all the tools for the current config
+ String flags = new String();
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int index = 0; index < tools.length; index++) {
+ ITool tool = tools[index];
+ if (tool.producesFileType(outputExtension)) {
+ flags = tool.getOutputPrefix();
+ }
+ }
+ return flags;
}
public IResource getOwner() {
@@ -406,5 +465,4 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return symbols;
}
-
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
index d9209a9c2a3..17a7cbfef34 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java
@@ -77,6 +77,8 @@ public class Option extends BuildObject implements IOption {
valueType = IOption.ENUMERATED;
else if (valueTypeStr.equals("includePath"))
valueType = IOption.INCLUDE_PATH;
+ else if (valueTypeStr.equals("libs"))
+ valueType = IOption.LIBRARIES;
else
valueType = IOption.PREPROCESSOR_SYMBOLS;
@@ -109,6 +111,7 @@ public class Option extends BuildObject implements IOption {
case IOption.STRING_LIST:
case IOption.INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS:
+ case IOption.LIBRARIES:
List valueList = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren("optionValue");
for (int i = 0; i < valueElements.length; ++i) {
@@ -185,6 +188,19 @@ public class Option extends BuildObject implements IOption {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getLibraries()
+ */
+ public String[] getLibraries() throws BuildException {
+ if (valueType != IOption.LIBRARIES) {
+ throw new BuildException("bad value type");
+ }
+ List v = (List)value;
+ return v != null
+ ? (String[])v.toArray(new String[v.size()])
+ : EMPTY_STRING_ARRAY;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
public String getSelectedEnum() throws BuildException {
@@ -265,7 +281,8 @@ public class Option extends BuildObject implements IOption {
{
if (valueType != IOption.STRING_LIST
|| valueType != IOption.INCLUDE_PATH
- || valueType != IOption.PREPROCESSOR_SYMBOLS)
+ || valueType != IOption.PREPROCESSOR_SYMBOLS
+ || valueType != IOption.LIBRARIES)
throw new BuildException("Bad value for type");
if (config == null) {
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
index 0228a7408db..e4db4b0530e 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
@@ -82,6 +82,7 @@ public class OptionReference implements IOption {
case IOption.STRING_LIST:
case IOption.INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS:
+ case IOption.LIBRARIES:
List valueList = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren("optionValue");
for (int i = 0; i < valueElements.length; ++i) {
@@ -116,6 +117,7 @@ public class OptionReference implements IOption {
case IOption.STRING_LIST:
case IOption.INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS:
+ case IOption.LIBRARIES:
List valueList = new ArrayList();
NodeList nodes = element.getElementsByTagName("optionValue");
for (int i = 0; i < nodes.getLength(); ++i) {
@@ -151,6 +153,7 @@ public class OptionReference implements IOption {
case IOption.STRING_LIST:
case IOption.INCLUDE_PATH:
case IOption.PREPROCESSOR_SYMBOLS:
+ case IOption.LIBRARIES:
ArrayList stringList = (ArrayList)value;
ListIterator iter = stringList.listIterator();
while (iter.hasNext()) {
@@ -227,6 +230,20 @@ public class OptionReference implements IOption {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getLibraries()
+ */
+ public String[] getLibraries() throws BuildException {
+ if (value == null)
+ return option.getLibraries();
+ else if (getValueType() == IOption.LIBRARIES) {
+ ArrayList list = (ArrayList)value;
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+ else
+ throw new BuildException("bad value type");
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
*/
public String getName() {
@@ -346,7 +363,8 @@ public class OptionReference implements IOption {
public void setValue(String [] value) throws BuildException {
if (getValueType() == IOption.STRING_LIST
|| getValueType() == IOption.INCLUDE_PATH
- || getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ || getValueType() == IOption.PREPROCESSOR_SYMBOLS
+ || getValueType() == IOption.LIBRARIES) {
// Just replace what the option reference is holding onto
this.value = new ArrayList(Arrays.asList(value));
}
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
index 38144dee074..5564b5b72b7 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java
@@ -44,6 +44,8 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
private String command;
private List inputExtensions;
private String outputExtension;
+ private String outputFlag;
+ private String outputPrefix;
public Tool(Target target) {
this.target = target;
@@ -86,6 +88,16 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
command = element.getAttribute("command") == null ?
new String() :
element.getAttribute("command");
+
+ // Get the flag to control output
+ outputFlag = element.getAttribute("outputFlag") == null ?
+ new String() :
+ element.getAttribute("outputFlag");
+
+ // Get the output prefix
+ outputPrefix = element.getAttribute("outputPrefix") == null ?
+ new String() :
+ element.getAttribute("outputPrefix");
// set up the category map
categoryMap = new HashMap();
@@ -178,6 +190,20 @@ public class Tool extends BuildObject implements ITool, IOptionCategory {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
+ */
+ public String getOutputFlag() {
+ return outputFlag == null ? new String() : outputFlag;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
+ */
+ public String getOutputPrefix() {
+ return outputPrefix == null ? new String() : outputPrefix;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOwner()
*/
public IOptionCategory getOwner() {
diff --git a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
index c388d540880..3ce12a2890f 100644
--- a/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
+++ b/core/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
@@ -220,6 +220,20 @@ public class ToolReference implements ITool {
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getOutputFlag()
+ */
+ public String getOutputFlag() {
+ return parent.getOutputFlag();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getOutputPrefix()
+ */
+ public String getOutputPrefix() {
+ return parent.getOutputPrefix();
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.ITool#getTarget()
*/
public ITarget getTarget() {
@@ -322,5 +336,4 @@ public class ToolReference implements ITool {
return parent.getOutputExtension(inputExtension);
}
-
}
diff --git a/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd b/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd
index 5c86003ad6b..af1df44f8d5 100644
--- a/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd
+++ b/core/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd
@@ -42,6 +42,11 @@
</element>
<element name="tool">
+ <annotation>
+ <documentation>
+ Defines a tool used in the build process.
+ </documentation>
+ </annotation>
<complexType>
<sequence>
<element ref="option"/>
@@ -92,6 +97,20 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="outputFlag" type="string">
+ <annotation>
+ <documentation>
+ An optional flag for tools that allow users to specify a name for the artifact of the tool. For example, the GCC compiler and linker tools typically allow the user to specify the name of the output with the &apos;-o&apos; flag, whereas the archiver that creates libraries does not.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="outputPrefix" type="string">
+ <annotation>
+ <documentation>
+ Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be lib&lt;target&gt;.a so &apos;lib&apos; would be the prefix.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
@@ -137,6 +156,8 @@ Two additional types exist to flag options of special relevance to the build mod
</enumeration>
<enumeration value="definedSymbols">
</enumeration>
+ <enumeration value="libs">
+ </enumeration>
</restriction>
</simpleType>
</attribute>
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/MakefileGenerator.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/MakefileGenerator.java
index c27bb1d03a6..801371d0dd9 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/MakefileGenerator.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/MakefileGenerator.java
@@ -19,6 +19,7 @@ import java.util.ListIterator;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.build.managed.IManagedBuildInfo;
+import org.eclipse.cdt.core.build.managed.ManagedBuildManager;
import org.eclipse.cdt.core.search.ICSearchConstants;
import org.eclipse.cdt.internal.core.model.Util;
import org.eclipse.cdt.internal.core.sourcedependency.DependencyManager;
@@ -197,10 +198,6 @@ public class MakefileGenerator {
buffer.append("RM := ");
buffer.append(info.getCleanCommand() + NEWLINE);
- // Add the macro for the output flag
- buffer.append("OUTPUT_FLAG := ");
- buffer.append(info.getOutputFlag() + NEWLINE);
-
buffer.append(CCorePlugin.getResourceString(SRC_LISTS) + NEWLINE);
buffer.append("C_SRCS := " + NEWLINE);
buffer.append("CC_SRCS := " + NEWLINE);
@@ -296,24 +293,53 @@ public class MakefileGenerator {
String extension = temp.getFileExtension();
/*
- * Write out the taqrget rule as:
- * <target>.<extension>: $(CC_SRCS:$(ROOT)/%.cpp=%.o) $(C_SRCS:$(ROOT)/%.c=%.o)
- * $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $@ $^ $(LIB_DEPS)
+ * Write out the target rule as:
+ * <prefix><target>.<extension>: $(CC_SRCS:$(ROOT)/%.cpp=%.o) $(C_SRCS:$(ROOT)/%.c=%.o)
+ * <cd <Proj_Dep_1/build_dir>; make all>
+ * <cd <Proj_Dep_.../build_dir>; make all>
+ * <cd <Proj_Dep_n/build_dir>; make all>
+ * $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG) $(OUTPUT_PREFIX)$@ $^ $(LIB_DEPS)
*/
String cmd = info.getToolForTarget(extension);
String flags = info.getFlagsForTarget(extension);
- buffer.append(target + COLON + WHITESPACE + "$(CC_SRCS:$(ROOT)/%.cpp=%.o) $(C_SRCS:$(ROOT)/%.c=%.o)" + NEWLINE);
- buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + "$(OUTPUT_FLAG) $@" + WHITESPACE + "$^" + WHITESPACE + NEWLINE);
+ String outflag = info.getOutputFlag(extension);
+ String outputPrefix = info.getOutputPrefix(extension);
+
+ buffer.append(outputPrefix + target + COLON + WHITESPACE + "$(CC_SRCS:$(ROOT)/%.cpp=%.o) $(C_SRCS:$(ROOT)/%.c=%.o)" + NEWLINE);
+ IProject[] deps;
+ try {
+ deps = project.getReferencedProjects();
+ for (int i = 0; i < deps.length; i++) {
+ IProject dep = deps[i];
+ String buildDir = dep.getLocation().toString();
+ if (ManagedBuildManager.manages(dep)) {
+ IManagedBuildInfo depInfo = ManagedBuildManager.getBuildInfo(dep);
+ buildDir += SEPARATOR + depInfo.getConfigurationName();
+ }
+ buffer.append(TAB + "cd" + WHITESPACE + buildDir + SEMI_COLON + WHITESPACE + "make all" + NEWLINE);
+ }
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + outputPrefix + "$@" + WHITESPACE + "$^");
+ String[] libraries = info.getLibsForTarget(extension);
+ for (int i = 0; i < libraries.length; i++) {
+ String lib = libraries[i];
+ buffer.append(WHITESPACE + lib);
+ }
+ buffer.append(NEWLINE);
buffer.append(NEWLINE);
// TODO Generate 'all' for now but determine the real rules from UI
- buffer.append("all: " + target + NEWLINE);
+ buffer.append("all: " + outputPrefix + target + NEWLINE);
buffer.append(NEWLINE);
// Always add a clean target
buffer.append(".PHONY: clean" + NEWLINE);
buffer.append("clean:" + NEWLINE);
- buffer.append(TAB + "$(RM)" + WHITESPACE + "${addprefix ., $(CC_SRCS:$(ROOT)%.cpp=%.o)} ${addprefix ., $(C_SRCS:$(ROOT)%.c=%.o)}" + WHITESPACE + target + NEWLINE);
+ buffer.append(TAB + "$(RM)" + WHITESPACE + "${addprefix ., $(CC_SRCS:$(ROOT)%.cpp=%.o)} ${addprefix ., $(C_SRCS:$(ROOT)%.c=%.o)}" + WHITESPACE + outputPrefix + target + NEWLINE);
buffer.append(NEWLINE);
buffer.append(NEWLINE + CCorePlugin.getResourceString(DEP_INCL) + NEWLINE);
@@ -329,7 +355,9 @@ public class MakefileGenerator {
String buildFlags = null;
String inputExtension = null;
String outputExtension = null;
-
+ String outflag = null;
+ String outputPrefix = null;
+
// Is there a special rule for this file
if (false) {
}
@@ -361,8 +389,9 @@ public class MakefileGenerator {
buffer.append(rule + NEWLINE);
cmd = info.getToolForSource(inputExtension);
buildFlags = info.getFlagsForSource(inputExtension);
-
- buffer.append(TAB + cmd + WHITESPACE + buildFlags + WHITESPACE + "$(OUTPUT_FLAG) $@" + WHITESPACE + "$<" + NEWLINE + NEWLINE);
+ outflag = info.getOutputFlag(outputExtension);
+ outputPrefix = info.getOutputPrefix(outputExtension);
+ buffer.append(TAB + cmd + WHITESPACE + buildFlags + WHITESPACE + outflag + WHITESPACE + outputPrefix + "$@" + WHITESPACE + "$<" + NEWLINE + NEWLINE);
}
}
diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index c527fb7180a..f53f24f1fda 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -1,3 +1,13 @@
+2003-07-24 Sean Evoy
+ * plugin.xml:
+ Added new attributes to tools and changed the value type enum for
+ libraries options. Also added a new flags option to archiver tool
+ in the Cygwin static library target specification.
+
+ * build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java
+ * build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java:
+ Changed to handle the libraries as a special option type.
+
2003-07-24 Hoda Amer
This patch updates the CModelBuilder to use the AST instead of the DOM.
diff --git a/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java b/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java
index 9f916cd7d0b..d50114390d0 100644
--- a/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java
+++ b/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java
@@ -80,6 +80,7 @@ public class BuildToolSettingsPage extends FieldEditorPreferencePage {
case IOption.STRING_LIST :
case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
addField(listField);
break;
@@ -129,6 +130,7 @@ public class BuildToolSettingsPage extends FieldEditorPreferencePage {
case IOption.STRING_LIST :
case IOption.INCLUDE_PATH :
case IOption.PREPROCESSOR_SYMBOLS :
+ case IOption.LIBRARIES :
String listStr = getPreferenceStore().getString(option.getId());
String[] listVal = BuildToolsSettingsStore.parseString(listStr);
ManagedBuildManager.setOption(configuration, option, listVal);
diff --git a/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java b/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java
index 67f3bc5ff66..aa5e64286e5 100644
--- a/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java
+++ b/core/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java
@@ -238,7 +238,14 @@ public class BuildToolsSettingsStore implements IPreferenceStore {
}
optionMap.put(name, value);
break;
-
+ case IOption.LIBRARIES :
+ try {
+ value = createList(opt.getLibraries());
+ } catch (BuildException e) {
+ break;
+ }
+ optionMap.put(name, value);
+ break;
default :
break;
}
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 3385bb5d120..d9a3c013d98 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -628,6 +628,7 @@
<tool
sources="c,cc,cpp,cxx,C"
name="%ToolName.compiler"
+ outputFlag="-o"
outputs="o"
command="g++"
id="org.eclipse.cdt.build.tool.cygwin.compiler">
@@ -761,6 +762,7 @@
</configuration>
<tool
name="%ToolName.linker"
+ outputFlag="-o"
outputs="exe"
command="g++"
id="org.eclipse.cdt.build.tool.cygwin.link">
@@ -787,7 +789,7 @@
name="Libraries"
category="cygwin.linker.category.general"
command="-l"
- valueType="stringList"
+ valueType="libs"
id="cygwin.link.libs">
</option>
<optionCategory
@@ -819,6 +821,7 @@
</configuration>
<tool
name="%ToolName.linker"
+ outputFlag="-o"
outputs="dll.a"
id="org.eclipse.cdt.build.tool.cygwin.solink">
<optionCategory
@@ -844,7 +847,7 @@
name="Libraries"
category="cygwin.solink.category.general"
command="-l"
- valueType="stringList"
+ valueType="libs"
id="cygwin.solink.libs">
</option>
</tool>
@@ -867,8 +870,21 @@
<tool
name="%ToolName.archiver"
outputs="a"
+ outputPrefix="lib"
command="ar"
id="org.eclipse.cdt.build.tool.cygwin.ar">
+ <optionCategory
+ owner="org.eclipse.cdt.build.tool.cygwin.ar"
+ name="General"
+ id="cygwin.ar.category.general">
+ </optionCategory>
+ <option
+ defaultValue="-r"
+ name="Archiver Flags"
+ category="cygwin.ar.category.general"
+ valueType="string"
+ id="cygwin.ar.flags">
+ </option>
</tool>
</target>
<target
@@ -878,6 +894,7 @@
id="linux">
<tool
name="Compiler"
+ outputFlag="-o"
id="linux.compiler">
<optionCategory
owner="linux.compiler"
@@ -906,6 +923,7 @@
id="linux.exec">
<tool
name="Linker"
+ outputFlag="-o"
id="org.eclipse.cdt.ui.tests.tool.linux.link">
</tool>
<configuration
@@ -926,6 +944,7 @@
id="linux.so">
<tool
name="Linker"
+ outputFlag="-o"
id="org.eclipse.cdt.ui.tests.tool.linux.solink">
</tool>
</target>
@@ -973,7 +992,7 @@
class="org.eclipse.cdt.internal.ui.search.ParentNameSorter"
id="org.eclipse.search.internal.ui.ParentNameSorter">
</sorter>
- <sorter
+ <sorter
pageId="org.eclipse.cdt.ui.CSearchPage"
label="%PathNameSorter.label"
icon="icons/full/clcl16/search_sortmatch.gif"

Back to the top