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

Introduce automatic variables in the Makefile editor.

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>
This commit is contained in:
Sebastian Bauer 2013-03-01 21:14:01 +01:00 committed by Andrew Gvozdev
parent c0c88fcf61
commit b2448e8582
3 changed files with 48 additions and 1 deletions

View file

@ -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

View file

@ -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;
}
}

View file

@ -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() {