Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 16:20:39 -0500
committerJonah Graham2018-11-20 16:20:39 -0500
commit48d2271a58a68743e428d3096d2bca054d04e310 (patch)
tree235ba23e71c393ad22d1d57fc8fdfec14754c4ee /build/org.eclipse.cdt.make.core
parent3cf0297769e5cfb91823e93ce570120a75fe01ce (diff)
downloadorg.eclipse.cdt-48d2271a58a68743e428d3096d2bca054d04e310.tar.gz
org.eclipse.cdt-48d2271a58a68743e428d3096d2bca054d04e310.tar.xz
org.eclipse.cdt-48d2271a58a68743e428d3096d2bca054d04e310.zip
Bug 540373: Normalize newlines with .gitattributes
There is also a new script to verify completeness of .gitattributes: releng/scripts/verify_gitattributes.sh Change-Id: I2ce270852ab54b66b6c474a6ec94203fe5bba78b
Diffstat (limited to 'build/org.eclipse.cdt.make.core')
-rw-r--r--build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd218
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java148
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java178
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java186
-rw-r--r--build/org.eclipse.cdt.make.core/templates/simple/Makefile50
5 files changed, 390 insertions, 390 deletions
diff --git a/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd b/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
index 8f3ad3f4c9..95e4953211 100644
--- a/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
+++ b/build/org.eclipse.cdt.make.core/schema/MakeTargetBuilder.exsd
@@ -1,109 +1,109 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.cdt.make.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.cdt.make.core" id="MakeTargetBuilder" name="Make Target Builder"/>
- </appInfo>
- <documentation>
- This extension point is used to identify builders that support IMakeBuidlerInfo an arguments.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="builder"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="builder">
- <complexType>
- <attribute name="builderID" type="string" use="required">
- <annotation>
- <documentation>
- Eclipse builder ID of the builder that supports target builds. (Must support IMakeInfo as argument).
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- id used to identify this target builder
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.cdt.make.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.cdt.make.core" id="MakeTargetBuilder" name="Make Target Builder"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to identify builders that support IMakeBuidlerInfo an arguments.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="builder"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="builder">
+ <complexType>
+ <attribute name="builderID" type="string" use="required">
+ <annotation>
+ <documentation>
+ Eclipse builder ID of the builder that supports target builds. (Must support IMakeInfo as argument).
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ id used to identify this target builder
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
index 5d6f82d292..3941e48ac0 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileBuildConfigurationProvider.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.make.core;
-
-import org.eclipse.cdt.core.build.ICBuildConfiguration;
-import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
-import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
-import org.eclipse.cdt.core.build.IToolChain;
-import org.eclipse.cdt.core.build.StandardBuildConfiguration;
-import org.eclipse.core.resources.IBuildConfiguration;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @since 7.4
- */
-public class MakefileBuildConfigurationProvider implements ICBuildConfigurationProvider {
-
- public static final String ID = "org.eclipse.cdt.make.core.provider"; //$NON-NLS-1$
-
- @Override
- public String getId() {
- return ID;
- }
-
- @Override
- public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name)
- throws CoreException {
- return new StandardBuildConfiguration(config, name);
- }
-
- @Override
- public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
- String launchMode, IProgressMonitor monitor) throws CoreException {
- ICBuildConfigurationManager configManager = MakeCorePlugin.getService(ICBuildConfigurationManager.class);
-
- StringBuilder configName = new StringBuilder("make."); //$NON-NLS-1$
- configName.append(launchMode);
- String os = toolChain.getProperty(IToolChain.ATTR_OS);
- if ("linux-container".equals(os)) { //$NON-NLS-1$
- String osConfigName = toolChain.getProperty("linux-container-id"); //$NON-NLS-1$
- configName.append('.');
- configName.append(osConfigName);
- } else {
- if (os != null) {
- configName.append('.');
- configName.append(os);
- }
- String arch = toolChain.getProperty(IToolChain.ATTR_ARCH);
- if (arch != null && !arch.isEmpty()) {
- configName.append('.');
- configName.append(arch);
- }
- }
- String name = configName.toString();
- int i = 0;
- while (configManager.hasConfiguration(this, project, name)) {
- name = configName.toString() + '.' + (++i);
- }
-
- IBuildConfiguration config = configManager.createBuildConfiguration(this, project, name, monitor);
- StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain,
- launchMode);
- configManager.addBuildConfiguration(config, makeConfig);
- return makeConfig;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.make.core;
+
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
+import org.eclipse.cdt.core.build.ICBuildConfigurationManager;
+import org.eclipse.cdt.core.build.ICBuildConfigurationProvider;
+import org.eclipse.cdt.core.build.IToolChain;
+import org.eclipse.cdt.core.build.StandardBuildConfiguration;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @since 7.4
+ */
+public class MakefileBuildConfigurationProvider implements ICBuildConfigurationProvider {
+
+ public static final String ID = "org.eclipse.cdt.make.core.provider"; //$NON-NLS-1$
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public ICBuildConfiguration getCBuildConfiguration(IBuildConfiguration config, String name)
+ throws CoreException {
+ return new StandardBuildConfiguration(config, name);
+ }
+
+ @Override
+ public ICBuildConfiguration createBuildConfiguration(IProject project, IToolChain toolChain,
+ String launchMode, IProgressMonitor monitor) throws CoreException {
+ ICBuildConfigurationManager configManager = MakeCorePlugin.getService(ICBuildConfigurationManager.class);
+
+ StringBuilder configName = new StringBuilder("make."); //$NON-NLS-1$
+ configName.append(launchMode);
+ String os = toolChain.getProperty(IToolChain.ATTR_OS);
+ if ("linux-container".equals(os)) { //$NON-NLS-1$
+ String osConfigName = toolChain.getProperty("linux-container-id"); //$NON-NLS-1$
+ configName.append('.');
+ configName.append(osConfigName);
+ } else {
+ if (os != null) {
+ configName.append('.');
+ configName.append(os);
+ }
+ String arch = toolChain.getProperty(IToolChain.ATTR_ARCH);
+ if (arch != null && !arch.isEmpty()) {
+ configName.append('.');
+ configName.append(arch);
+ }
+ }
+ String name = configName.toString();
+ int i = 0;
+ while (configManager.hasConfiguration(this, project, name)) {
+ name = configName.toString() + '.' + (++i);
+ }
+
+ IBuildConfiguration config = configManager.createBuildConfiguration(this, project, name, monitor);
+ StandardBuildConfiguration makeConfig = new StandardBuildConfiguration(config, name, toolChain,
+ launchMode);
+ configManager.addBuildConfiguration(config, makeConfig);
+ return makeConfig;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
index 69f6b544f4..cfc0e622e7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakefileProjectGenerator.java
@@ -1,89 +1,89 @@
-/*******************************************************************************
- * Copyright (c) 2017 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.cdt.make.core;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.core.build.CBuilder;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.IPathEntry;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
-import org.eclipse.tools.templates.freemarker.SourceRoot;
-import org.eclipse.tools.templates.freemarker.TemplateManifest;
-import org.osgi.framework.Bundle;
-
-/**
- * Generator for Makefile projects.
- *
- * @since 7.4
- */
-public class MakefileProjectGenerator extends FMProjectGenerator {
-
- public MakefileProjectGenerator(String manifestPath) {
- super(manifestPath);
- }
-
- @Override
- protected Bundle getSourceBundle() {
- return MakeCorePlugin.getDefault().getBundle();
- }
-
- @Override
- protected void initProjectDescription(IProjectDescription description) throws CoreException {
- description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID,
- MakeProjectNature.NATURE_ID });
- ICommand command = description.newCommand();
- CBuilder.setupBuilder(command);
- description.setBuildSpec(new ICommand[] { command });
- }
-
- @Override
- public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
- super.generate(model, monitor);
-
- List<IPathEntry> entries = new ArrayList<>();
- IProject project = getProject();
-
- // Create the source and output folders
- IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
-
- TemplateManifest manifest = getManifest();
- if (manifest != null) {
- List<SourceRoot> srcRoots = getManifest().getSrcRoots();
- if (srcRoots != null && !srcRoots.isEmpty()) {
- for (SourceRoot srcRoot : srcRoots) {
- IFolder sourceFolder = project.getFolder(srcRoot.getDir());
- if (!sourceFolder.exists()) {
- sourceFolder.create(true, true, monitor);
- }
-
- entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
- new IPath[] { buildFolder.getFullPath() }));
- }
- } else {
- entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
- }
- }
-
- entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath()));
- CoreModel.getDefault().create(project)
- .setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2017 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.make.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.core.build.CBuilder;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.tools.templates.freemarker.FMProjectGenerator;
+import org.eclipse.tools.templates.freemarker.SourceRoot;
+import org.eclipse.tools.templates.freemarker.TemplateManifest;
+import org.osgi.framework.Bundle;
+
+/**
+ * Generator for Makefile projects.
+ *
+ * @since 7.4
+ */
+public class MakefileProjectGenerator extends FMProjectGenerator {
+
+ public MakefileProjectGenerator(String manifestPath) {
+ super(manifestPath);
+ }
+
+ @Override
+ protected Bundle getSourceBundle() {
+ return MakeCorePlugin.getDefault().getBundle();
+ }
+
+ @Override
+ protected void initProjectDescription(IProjectDescription description) throws CoreException {
+ description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID,
+ MakeProjectNature.NATURE_ID });
+ ICommand command = description.newCommand();
+ CBuilder.setupBuilder(command);
+ description.setBuildSpec(new ICommand[] { command });
+ }
+
+ @Override
+ public void generate(Map<String, Object> model, IProgressMonitor monitor) throws CoreException {
+ super.generate(model, monitor);
+
+ List<IPathEntry> entries = new ArrayList<>();
+ IProject project = getProject();
+
+ // Create the source and output folders
+ IFolder buildFolder = getProject().getFolder("build"); //$NON-NLS-1$
+
+ TemplateManifest manifest = getManifest();
+ if (manifest != null) {
+ List<SourceRoot> srcRoots = getManifest().getSrcRoots();
+ if (srcRoots != null && !srcRoots.isEmpty()) {
+ for (SourceRoot srcRoot : srcRoots) {
+ IFolder sourceFolder = project.getFolder(srcRoot.getDir());
+ if (!sourceFolder.exists()) {
+ sourceFolder.create(true, true, monitor);
+ }
+
+ entries.add(CoreModel.newSourceEntry(sourceFolder.getFullPath(),
+ new IPath[] { buildFolder.getFullPath() }));
+ }
+ } else {
+ entries.add(CoreModel.newSourceEntry(getProject().getFullPath()));
+ }
+ }
+
+ entries.add(CoreModel.newOutputEntry(buildFolder.getFullPath()));
+ CoreModel.getDefault().create(project)
+ .setRawPathEntries(entries.toArray(new IPathEntry[entries.size()]), monitor);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
index 8ecb3e935e..dfe235e80e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/GCCSpecsRunSIProvider.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.internal.core.scannerconfig2;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.CCProjectNature;
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
-import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Runs a command to retrieve compiler intrinsic scanner info from 'specs' file.
- *
- * @author vhirsl
- */
-public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
- */
- @Override
- protected boolean initialize() {
- boolean rc = super.initialize();
-
- if (rc) {
- String targetFile = "dummy"; //$NON-NLS-1$
- IProject project = resource.getProject();
- try {
- if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
- targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
- }
- else if (project.hasNature(CProjectNature.C_NATURE_ID)) {
- targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
- }
- // replace string variables in compile arguments
- // TODO Vmir - use string variable replacement
- for (int i = 0; i < fCompileArguments.length; ++i) {
- fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
- MakeCorePlugin.getWorkingDirectory().toString());
- fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{specs_file\\}", targetFile); //$NON-NLS-1$
- }
- } catch (CoreException e) {
- //TODO VMIR better error handling
- MakeCorePlugin.log(e.getStatus());
- rc = false;
- }
- }
- return rc;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
- */
- @Override
- protected String[] prepareArguments(boolean isDefaultCommand) {
- if (collector == null)
- return fCompileArguments;
-
- @SuppressWarnings("unchecked")
- List<String> tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
- if (tso == null || tso.size() == 0) {
- return fCompileArguments;
- }
-
- String[] rv = null;
- // commandArguments may have multiple arguments; tokenizing
- int nTokens = 0;
- if (fCompileArguments != null && fCompileArguments.length > 0) {
- nTokens = fCompileArguments.length;
- rv = new String[nTokens + tso.size()];
- System.arraycopy(fCompileArguments, 0, rv, 0, nTokens);
- }
- else {
- rv = new String[tso.size()];
- }
- for (int i = 0; i < tso.size(); ++i) {
- rv[nTokens + i] = tso.get(i);
- }
- return rv;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.core.scannerconfig2;
+
+import java.util.List;
+
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
+import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Runs a command to retrieve compiler intrinsic scanner info from 'specs' file.
+ *
+ * @author vhirsl
+ */
+public class GCCSpecsRunSIProvider extends DefaultRunSIProvider {
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#initialize()
+ */
+ @Override
+ protected boolean initialize() {
+ boolean rc = super.initialize();
+
+ if (rc) {
+ String targetFile = "dummy"; //$NON-NLS-1$
+ IProject project = resource.getProject();
+ try {
+ if (project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
+ }
+ else if (project.hasNature(CProjectNature.C_NATURE_ID)) {
+ targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
+ }
+ // replace string variables in compile arguments
+ // TODO Vmir - use string variable replacement
+ for (int i = 0; i < fCompileArguments.length; ++i) {
+ fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
+ MakeCorePlugin.getWorkingDirectory().toString());
+ fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{specs_file\\}", targetFile); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ //TODO VMIR better error handling
+ MakeCorePlugin.log(e.getStatus());
+ rc = false;
+ }
+ }
+ return rc;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.internal.core.scannerconfig2.DefaultRunSIProvider#prepareArguments(boolean)
+ */
+ @Override
+ protected String[] prepareArguments(boolean isDefaultCommand) {
+ if (collector == null)
+ return fCompileArguments;
+
+ @SuppressWarnings("unchecked")
+ List<String> tso = collector.getCollectedScannerInfo(resource.getProject(), ScannerInfoTypes.TARGET_SPECIFIC_OPTION);
+ if (tso == null || tso.size() == 0) {
+ return fCompileArguments;
+ }
+
+ String[] rv = null;
+ // commandArguments may have multiple arguments; tokenizing
+ int nTokens = 0;
+ if (fCompileArguments != null && fCompileArguments.length > 0) {
+ nTokens = fCompileArguments.length;
+ rv = new String[nTokens + tso.size()];
+ System.arraycopy(fCompileArguments, 0, rv, 0, nTokens);
+ }
+ else {
+ rv = new String[tso.size()];
+ }
+ for (int i = 0; i < tso.size(); ++i) {
+ rv[nTokens + i] = tso.get(i);
+ }
+ return rv;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.make.core/templates/simple/Makefile b/build/org.eclipse.cdt.make.core/templates/simple/Makefile
index bcf0bb59a7..7fe5793f75 100644
--- a/build/org.eclipse.cdt.make.core/templates/simple/Makefile
+++ b/build/org.eclipse.cdt.make.core/templates/simple/Makefile
@@ -1,25 +1,25 @@
-PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
-
-OBJS = ${projectName}.o
-
-ifeq ($(BUILD_MODE),debug)
- CFLAGS += -g
-else ifeq ($(BUILD_MODE),run)
- CFLAGS += -O2
-else
- $(error Build mode $(BUILD_MODE) not supported by this Makefile)
-endif
-
-all: ${projectName}
-
-${projectName}: $(OBJS)
- $(CXX) -o $@ $^
-
-%.o: $(PROJECT_ROOT)%.cpp
- $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
-
-%.o: $(PROJECT_ROOT)%.c
- $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
-
-clean:
- rm -fr ${projectName} $(OBJS)
+PROJECT_ROOT = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+
+OBJS = ${projectName}.o
+
+ifeq ($(BUILD_MODE),debug)
+ CFLAGS += -g
+else ifeq ($(BUILD_MODE),run)
+ CFLAGS += -O2
+else
+ $(error Build mode $(BUILD_MODE) not supported by this Makefile)
+endif
+
+all: ${projectName}
+
+${projectName}: $(OBJS)
+ $(CXX) -o $@ $^
+
+%.o: $(PROJECT_ROOT)%.cpp
+ $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
+
+%.o: $(PROJECT_ROOT)%.c
+ $(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
+
+clean:
+ rm -fr ${projectName} $(OBJS)

Back to the top