summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Bauer2013-03-01 15:14:01 (EST)
committer Andrew Gvozdev2013-03-06 19:58:30 (EST)
commitb2448e8582ff540ad3d83da2db30a9b0e7c6cd5a (patch)
tree75e50270e691345f62d7e3fcb8cb0237d992f219
parentc0c88fcf612d1b584b1e0341f6820a9474720a08 (diff)
downloadorg.eclipse.cdt-b2448e8582ff540ad3d83da2db30a9b0e7c6cd5a.zip
org.eclipse.cdt-b2448e8582ff540ad3d83da2db30a9b0e7c6cd5a.tar.gz
org.eclipse.cdt-b2448e8582ff540ad3d83da2db30a9b0e7c6cd5a.tar.bz2
Introduce automatic variables in the Makefile editor.refs/changes/86/10786/3
Added a special class for automatic variables. Use some instances for built-in variables of a makefile allowing to choose from them in the content assist. Change-Id: I653a5fa536afc5f9e3112314720928a4f22692c7 Reviewed-on: https://git.eclipse.org/r/10786 IP-Clean: Andrew Gvozdev <angvoz.dev@gmail.com> Tested-by: Andrew Gvozdev <angvoz.dev@gmail.com> Reviewed-by: Andrew Gvozdev <angvoz.dev@gmail.com>
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileResources.properties6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java33
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java10
3 files changed, 48 insertions, 1 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileResources.properties b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileResources.properties
index 2a8f760..cda473d 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileResources.properties
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileResources.properties
@@ -22,3 +22,9 @@ MakefileValidator.error.endefMissingOverrideDefine=endef missing [override] defi
MakefileValidator.error.unknownDirective=unknow directive
MakefileValidator.error.noMatchingEndifForCondition=No matching endif for condition
MakefileValidator.error.noMatchingEndefForOverrideDefine=No matching endef for [override] define
+GNUMakefile.automatic.at=Target of the rule
+GNUMakefile.automatic.lt=First prerequisite of the rule
+GNUMakefile.automatic.star=Stem with which an implicit rule matches
+GNUMakefile.automatic.qm=All prerequisites that are newer than the target
+GNUMakefile.automatic.percent=Target member name, when the target is an archive member
+GNUMakefile.automatic.up=All prerequisites
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java
new file mode 100644
index 0000000..df6862b
--- /dev/null
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/AutomaticVariable.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Sebastian Bauer 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:
+ * Sebastian Bauer - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.make.internal.core.makefile.gnu;
+
+import org.eclipse.cdt.make.internal.core.makefile.Directive;
+
+
+/**
+ * Represents an automatic variable. Automatic variables are implicit and
+ * computed for each rule that is applied.
+ *
+ * @author Sebastian Bauer <mail@sebastianbauer.info>
+ * @see "http://www.gnu.org/software/make/manual/make.html#Automatic-Variables"
+ */
+public class AutomaticVariable extends VariableDefinition {
+
+ public AutomaticVariable(Directive parent, String name, String description) {
+ super(parent, name, new StringBuffer(description));
+ }
+
+ @Override
+ public boolean isAutomatic() {
+ return true;
+ }
+}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
index 295144c..4d2b484 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java
@@ -36,6 +36,7 @@ import org.eclipse.cdt.make.internal.core.makefile.EmptyLine;
import org.eclipse.cdt.make.internal.core.makefile.IgnoreRule;
import org.eclipse.cdt.make.internal.core.makefile.InferenceRule;
import org.eclipse.cdt.make.internal.core.makefile.MakeFileConstants;
+import org.eclipse.cdt.make.internal.core.makefile.MakefileMessages;
import org.eclipse.cdt.make.internal.core.makefile.MakefileReader;
import org.eclipse.cdt.make.internal.core.makefile.PosixRule;
import org.eclipse.cdt.make.internal.core.makefile.PreciousRule;
@@ -76,7 +77,14 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile {
public static String FILE_SEPARATOR = System.getProperty("file.separator", "/"); //$NON-NLS-1$ //$NON-NLS-2$
String[] includeDirectories = new String[0];
- IDirective[] builtins = new IDirective[0];
+ IDirective[] builtins = new IDirective[]{
+ new AutomaticVariable(this, "<", MakefileMessages.getString("GNUMakefile.automatic.lt")),//$NON-NLS-1$//$NON-NLS-2$
+ new AutomaticVariable(this, "*", MakefileMessages.getString("GNUMakefile.automatic.star")),//$NON-NLS-1$//$NON-NLS-2$
+ new AutomaticVariable(this, "@", MakefileMessages.getString("GNUMakefile.automatic.at")),//$NON-NLS-1$//$NON-NLS-2$
+ new AutomaticVariable(this, "?", MakefileMessages.getString("GNUMakefile.automatic.qm")),//$NON-NLS-1$//$NON-NLS-2$
+ new AutomaticVariable(this, "%", MakefileMessages.getString("GNUMakefile.automatic.percent")),//$NON-NLS-1$//$NON-NLS-2$
+ new AutomaticVariable(this, "^", MakefileMessages.getString("GNUMakefile.automatic.up")),//$NON-NLS-1$//$NON-NLS-2$
+ };
private IMakefileReaderProvider makefileReaderProvider;
public GNUMakefile() {