diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/DefaultRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/DefaultRule.java index e934bb2652e..69d626bed8b 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/DefaultRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/DefaultRule.java @@ -20,7 +20,7 @@ import org.eclipse.cdt.make.core.makefile.IDefaultRule; public class DefaultRule extends SpecialRule implements IDefaultRule { public DefaultRule(Directive parent, Command[] cmds) { - super(parent, new Target(".DEFAULT"), new String[0], cmds); //$NON-NLS-1$ + super(parent, new Target(MakeFileConstants.RULE_DEFAULT), new String[0], cmds); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/IgnoreRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/IgnoreRule.java index 80b35c48ea8..c42371f119d 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/IgnoreRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/IgnoreRule.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.make.core.makefile.IIgnoreRule; public class IgnoreRule extends SpecialRule implements IIgnoreRule { public IgnoreRule(Directive parent, String[] reqs) { - super(parent, new Target(".IGNORE"), reqs, new Command[0]); //$NON-NLS-1$ + super(parent, new Target(MakeFileConstants.RULE_IGNORE), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java new file mode 100644 index 00000000000..eb29e17bd79 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileConstants.java @@ -0,0 +1,22 @@ +/* + * Created on Mar 2, 2004 + * + * Copyright (c) 2002,2003 QNX Software Systems Ltd. + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.internal.core.makefile; + + +public class MakeFileConstants { + + public static final String RULE_DEFAULT = ".DEFAULT"; //$NON-NLS-1$ + public static final String RULE_IGNORE =".IGNORE"; //$NON-NLS-1$ + public static final String RULE_POSIX = ".POSIX"; //$NON-NLS-1$ + public static final String RULE_PRECIOUS = ".PRECIOUS"; //$NON-NLS-1$ + public static final String RULE_SCCS_GET = ".SCCS_GET"; //$NON-NLS-1$ + public static final String RULE_SILENT = ".SILENT"; //$NON-NLS-1$ + public static final String RULE_SUFFIXES = ".SUFFIXES"; //$NON-NLS-1$ + +} 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 new file mode 100644 index 00000000000..81a5fce922f --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakeFileResources.properties @@ -0,0 +1,13 @@ +MakefileValidator.errorBuild=Error Build +MakefileValidator.errorResource=Error resource +MakefileValidator.warningInfo=Warning info +MakefileValidator.warning=Warning +MakefileValidator.unknown=unknown +MakefileValidator.checkingFile=Checking file : +MakefileValidator.fileChecked=File checked +MakefileValidator.error.elseMissingIfCondition=else missing if condition +MakefileValidator.error.endifMissingIfElseCondition=Endif missing if/else condition +MakefileValidator.error.endefMissingOverrideDefine=endef missing [override] define +MakefileValidator.error.unknownDirective=unknow directive +MakefileValidator.error.noMatchingEndifForCondition=No matching endif for condition +MakefileValidator.error.noMatchingEndefForOverrideDefine=No matching endef for [override] define diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java new file mode 100644 index 00000000000..38dc695a2bf --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/MakefileMessages.java @@ -0,0 +1,31 @@ +/* + * Created on Mar 3, 2004 + * + * Copyright (c) 2002,2003 QNX Software Systems Ltd. + * + * Contributors: + * QNX Software Systems - Initial API and implementation + ***********************************************************************/ +package org.eclipse.cdt.make.internal.core.makefile; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class MakefileMessages { + + private static final String BUNDLE_NAME = "org.eclipse.cdt.make.internal.core.makefile.MakeFileResources";//$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private MakefileMessages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PosixRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PosixRule.java index 5ab25e01a9d..ef905c4f17f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PosixRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PosixRule.java @@ -20,6 +20,6 @@ import org.eclipse.cdt.make.core.makefile.IPosixRule; public class PosixRule extends SpecialRule implements IPosixRule { public PosixRule(Directive parent) { - super(parent, new Target(".POSIX"), new String[0], new Command[0]); //$NON-NLS-1$ + super(parent, new Target(MakeFileConstants.RULE_POSIX), new String[0], new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PreciousRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PreciousRule.java index 6b4f278e1b2..3ecd0340145 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PreciousRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/PreciousRule.java @@ -20,7 +20,7 @@ import org.eclipse.cdt.make.core.makefile.IPreciousRule; public class PreciousRule extends SpecialRule implements IPreciousRule { public PreciousRule(Directive parent, String[] reqs) { - super(parent, new Target(".PRECIOUS"), reqs, new Command[0]); //$NON-NLS-1$ + super(parent, new Target(MakeFileConstants.RULE_PRECIOUS), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SccsGetRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SccsGetRule.java index 1e089a46c5d..cc732ca476e 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SccsGetRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SccsGetRule.java @@ -22,7 +22,7 @@ import org.eclipse.cdt.make.core.makefile.ISccsGetRule; public class SccsGetRule extends SpecialRule implements ISccsGetRule { public SccsGetRule(Directive parent, Command[] cmds) { - super(parent, new Target(".SCCS_GET"), new String[0], cmds); //$NON-NLS-1$ + super(parent, new Target(MakeFileConstants.RULE_SCCS_GET), new String[0], cmds); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SilentRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SilentRule.java index 0576f4dfac6..89cfa566568 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SilentRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SilentRule.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.make.core.makefile.ISilentRule; public class SilentRule extends SpecialRule implements ISilentRule { public SilentRule(Directive parent, String[] reqs) { - super(parent, new Target(".SILENT"), reqs, new Command[0]); //$NON-NLS-1$ + super(parent, new Target(MakeFileConstants.RULE_SILENT), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SuffixesRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SuffixesRule.java index b54797f8830..dd208951f85 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SuffixesRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/SuffixesRule.java @@ -21,7 +21,7 @@ import org.eclipse.cdt.make.core.makefile.ISuffixesRule; public class SuffixesRule extends SpecialRule implements ISuffixesRule { public SuffixesRule(Directive parent, String[] suffixes) { - super(parent, new Target(".SUFFIXES"), suffixes, new Command[0]); //$NON-NLS-1$ + super(parent, new Target(MakeFileConstants.RULE_SUFFIXES), suffixes, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java index 972666d4605..7950f800962 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Conditional.java @@ -16,6 +16,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Parent; public abstract class Conditional extends Parent implements IConditional { + private static final String EMPTY = ""; //$NON-NLS-1$ String cond; String arg1; String arg2; @@ -27,7 +28,7 @@ public abstract class Conditional extends Parent implements IConditional { } public Conditional(Directive parent) { - this(parent, "", "", ""); + this(parent, EMPTY, EMPTY, EMPTY); } public Conditional(Directive parent, String conditional, String argument1, String argument2) { @@ -88,7 +89,7 @@ public abstract class Conditional extends Parent implements IConditional { char terminal = line.charAt(0) == '(' ? ',' : line.charAt(0); if (line.length() < 5 && terminal != ',' && terminal != '"' && terminal != '\'') { - arg1 = arg2 = ""; + arg1 = arg2 = EMPTY; return; } @@ -125,7 +126,7 @@ public abstract class Conditional extends Parent implements IConditional { terminal = terminal == ',' ? ')' : line.charAt(0); if (terminal != ')' && terminal != '"' && terminal != '\'') { - arg2 = ""; + arg2 = EMPTY; return; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java index ed43f562c64..e02203e0d11 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DefineVariable.java @@ -24,10 +24,10 @@ public class DefineVariable extends VariableDefinition { } public String toString() { - StringBuffer sb = new StringBuffer("define"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_DEFINE); sb.append(getName()).append('\n'); sb.append(getValue()); - sb.append("endef"); + sb.append(GNUMakefileConstants.TERMINAL_ENDEF); return sb.toString(); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DeleteOnErrorRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DeleteOnErrorRule.java index 97a5661460d..bb6ee43b390 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DeleteOnErrorRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/DeleteOnErrorRule.java @@ -26,7 +26,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Target; public class DeleteOnErrorRule extends SpecialRule implements IDeleteOnErrorRule { public DeleteOnErrorRule(Directive parent, String[] reqs) { - super(parent, new Target(".DELETE_ON_ERROR"), reqs, new Command[0]); + super(parent, new Target(GNUMakefileConstants.RULE_DELETE_ON_ERROR), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java index 08f8aab5eb0..445a275c53b 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java @@ -24,6 +24,6 @@ public class Else extends Conditional { } public String toString() { - return "else"; + return GNUMakefileConstants.CONDITIONAL_ELSE; } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java index 8fe6d6c7217..3048eeefc91 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java @@ -22,4 +22,8 @@ public class Endef extends Terminal { public boolean isEndef() { return true; } + + public String toString() { + return GNUMakefileConstants.TERMINAL_ENDEF; + } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java index 2e49fd6d512..d89f13e6781 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java @@ -21,5 +21,8 @@ public class Endif extends Terminal { public boolean isEndif() { return true; } - + + public String toString() { + return GNUMakefileConstants.TERMINAL_ENDIF; + } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportAllVariablesRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportAllVariablesRule.java index 97965266fbb..59bed0ce1c7 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportAllVariablesRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/ExportAllVariablesRule.java @@ -24,7 +24,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Target; public class ExportAllVariablesRule extends SpecialRule implements IExportAllVariablesRule { public ExportAllVariablesRule(Directive parent, String[] reqs) { - super(parent, new Target(".EXPORT_ALL_VARIABLES"), reqs, new Command[0]); + super(parent, new Target(GNUMakefileConstants.RULE_EXPORT_ALL_VARIABLES), reqs, new Command[0]); } } 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 a04e8c1138a..0a91e190286 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 @@ -34,6 +34,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.MacroDefinition; +import org.eclipse.cdt.make.internal.core.makefile.MakeFileConstants; 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; @@ -65,8 +66,8 @@ import org.eclipse.core.runtime.Path; public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { - public static String PATH_SEPARATOR = System.getProperty("path.separator", ":"); - public static String FILE_SEPARATOR = System.getProperty("file.separator", "/"); + public static String PATH_SEPARATOR = System.getProperty("path.separator", ":"); //$NON-NLS-1$ //$NON-NLS-2$ + public static String FILE_SEPARATOR = System.getProperty("file.separator", "/"); //$NON-NLS-1$ //$NON-NLS-2$ String[] includeDirectories = new String[0]; IDirective[] builtins = null; @@ -392,33 +393,33 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { keyword = line; reqs = new String[0]; } - if (".IGNORE".equals(keyword)) { + if (keyword.equals(MakeFileConstants.RULE_IGNORE)) { special = new IgnoreRule(this, reqs); - } else if (".POSIX".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_POSIX)) { special = new PosixRule(this); - } else if (".PRECIOUS".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_PRECIOUS)) { special = new PreciousRule(this, reqs); - } else if (".SILENT".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_SILENT)) { special = new SilentRule(this, reqs); - } else if (".SUFFIXES".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_SUFFIXES)) { special = new SuffixesRule(this, reqs); - } else if (".DEFAULT".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_DEFAULT)) { special = new DefaultRule(this, new Command[0]); - } else if (".SCCS_GET".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_SCCS_GET)) { special = new SccsGetRule(this, new Command[0]); - } else if (".PHONY".equals(keyword)) { + } else if (keyword.equals(GNUMakefileConstants.RULE_PHONY)) { special = new PhonyRule(this, reqs); - } else if (".INTERMEDIATE".equals(keyword)) { + } else if (keyword.equals(GNUMakefileConstants.RULE_INTERMEDIATE)) { special = new IntermediateRule(this, reqs); - } else if (".SECONDARY".equals(keyword)) { + } else if (keyword.equals(GNUMakefileConstants.RULE_SECONDARY)) { special = new SecondaryRule(this, reqs); - } else if (".DELETE_ON_ERROR".equals(keyword)) { + } else if (keyword.equals(GNUMakefileConstants.RULE_DELETE_ON_ERROR)) { special = new DeleteOnErrorRule(this, reqs); - } else if (".LOW_RESOLUTION_TIME".equals(keyword)) { + } else if (keyword.equals(GNUMakefileConstants.RULE_LOW_RESOLUTION_TIME)) { special = new LowResolutionTimeRule(this, reqs); - } else if (".EXPORT_ALL_VARIABLES".equals(keyword)) { + } else if (keyword.equals(GNUMakefileConstants.RULE_EXPORT_ALL_VARIABLES)) { special = new ExportAllVariablesRule(this, reqs); - } else if (".NOTPARALLEL".equals(keyword)) { + } else if (keyword.equals(GNUMakefileConstants.RULE_NOT_PARALLEL)) { special = new NotParallelRule(this, reqs); } return special; @@ -449,15 +450,15 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { if (keyword == null) { keyword = line; } - if (keyword.equals("ifdef")) { + if (keyword.equals(GNUMakefileConstants.CONDITIONAL_IFDEF)) { condition = new Ifdef(this, line); - } else if (keyword.equals("ifndef")) { + } else if (keyword.equals(GNUMakefileConstants.CONDITIONAL_IFNDEF)) { condition = new Ifndef(this, line); - } else if (keyword.equals("ifeq")) { + } else if (keyword.equals(GNUMakefileConstants.CONDITIONAL_IFEQ)) { condition = new Ifeq(this, line); - } else if (keyword.equals("ifneq")) { + } else if (keyword.equals(GNUMakefileConstants.CONDITIONAL_IFNEQ)) { condition = new Ifneq(this, line); - } else if (keyword.equals("else")) { + } else if (keyword.equals(GNUMakefileConstants.CONDITIONAL_ELSE)) { condition = new Else(this); } return condition; @@ -516,7 +517,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { } else if (count == 1) { pattern = st.nextToken(); } else if (count == 3) { - String delim = " \t\n\r\f" + GNUMakefile.PATH_SEPARATOR; + String delim = " \t\n\r\f" + GNUMakefile.PATH_SEPARATOR; //$NON-NLS-1$ dirs.add(st.nextToken(delim)); } else { dirs.add(st.nextToken()); @@ -559,7 +560,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { // Some TargetRule have "::" for separator String req = line.substring(index + 1); - doubleColon = req.startsWith(":"); + doubleColon = req.startsWith(":"); //$NON-NLS-1$ if (doubleColon) { // move pass the second ':' req = req.substring(1); @@ -581,7 +582,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { orderReq = req.substring(pipe + 1); } else { normalReq = req; - orderReq = ""; + orderReq = ""; //$NON-NLS-1$ } normalReqs = GNUMakefileUtil.findPrerequisites(normalReq.trim()); @@ -612,7 +613,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { boolean isOverride = false; boolean isTargetVariable = false; boolean isExport = false; - String targetName = ""; + String targetName = ""; //$NON-NLS-1$ String name; StringBuffer value = new StringBuffer(); @@ -625,7 +626,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { targetName = line.substring(0, colon).trim(); line = line.substring(colon + 1).trim(); } else { - targetName = ""; + targetName = ""; //$NON-NLS-1$ } } @@ -726,12 +727,12 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { prereqPatterns[i] = st.nextToken(); } } else { - targetPattern = ""; + targetPattern = ""; //$NON-NLS-1$ prereqPatterns = new String[0]; } } else { targets = new String[0]; - targetPattern = ""; + targetPattern = ""; //$NON-NLS-1$ prereqPatterns = new String[0]; } @@ -762,7 +763,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { */ public IDirective[] getBuiltins() { if (builtins == null) { - String location = "builtin" + File.separator + "gnu.mk"; + String location = "builtin" + File.separator + "gnu.mk"; //$NON-NLS-1$ //$NON-NLS-2$ try { InputStream stream = MakeCorePlugin.getDefault().openStream(new Path(location)); GNUMakefile gnu = new GNUMakefile(); @@ -793,7 +794,7 @@ public class GNUMakefile extends AbstractMakefile implements IGNUMakefile { public static void main(String[] args) { try { - String filename = "Makefile"; + String filename = "Makefile"; //$NON-NLS-1$ if (args.length == 1) { filename = args[0]; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java index 38edd5f1169..6e5bf79642e 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileChecker.java @@ -122,7 +122,7 @@ public class GNUMakefileChecker extends ACBuilder { protected IFile[] getCandidateMakefiles(IProject proj) { // FIXME: Find the candidate in the store somewhere. - IFile defaultMakefile = proj.getFile(new Path("Makefile")); + IFile defaultMakefile = proj.getFile(new Path("Makefile")); //$NON-NLS-1$ if (defaultMakefile.exists()) { return new IFile[] {defaultMakefile}; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java new file mode 100644 index 00000000000..be91ac9ba7e --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileConstants.java @@ -0,0 +1,40 @@ +/* + * Created on Mar 2, 2004 + * + * Copyright (c) 2002,2003 QNX Software Systems Ltd. + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakeFileConstants; + + +public class GNUMakefileConstants extends MakeFileConstants { + static final String CONDITIONAL_ELSE = "else"; //$NON-NLS-1$ + static final String CONDITIONAL_IFNEQ = "ifneq"; //$NON-NLS-1$ + static final String CONDITIONAL_IFNDEF = "ifndef"; //$NON-NLS-1$ + static final String CONDITIONAL_IFEQ = "ifeq"; //$NON-NLS-1$ + static final String CONDITIONAL_IFDEF = "ifdef"; //$NON-NLS-1$ + + static final String TERMINAL_ENDEF = "endef"; //$NON-NLS-1$ + static final String TERMINAL_ENDIF = "endif"; //$NON-NLS-1$ + + static final String DIRECTIVE_VPATH = "vpath"; //$NON-NLS-1$ + static final String DIRECTIVE_UNEXPORT = "unexport"; //$NON-NLS-1$ + + static final String VARIABLE_DEFINE = "define"; //$NON-NLS-1$ + static final String VARIABLE_EXPORT = "export"; //$NON-NLS-1$ + static final String VARIABLE_OVERRIDE = "override"; //$NON-NLS-1$ + + static final String DIRECTIVE_INCLUDE = "include"; //$NON-NLS-1$ + + static final String RULE_DELETE_ON_ERROR = ".DELETE_ON_ERROR"; //$NON-NLS-1$ + static final String RULE_PHONY = ".PHONY"; //$NON-NLS-1$ + static final String RULE_SECONDARY = ".SECONDARY"; //$NON-NLS-1$ + static final String RULE_LOW_RESOLUTION_TIME = ".LOW_RESOLUTION_TIME"; //$NON-NLS-1$ + static final String RULE_NOT_PARALLEL = ".NOTPARALLEL"; //$NON-NLS-1$ + static final String RULE_EXPORT_ALL_VARIABLES = ".EXPORT_ALL_VARIABLES"; //$NON-NLS-1$ + static final String RULE_INTERMEDIATE = ".INTERMEDIATE"; //$NON-NLS-1$ +} diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java index 7651b7b32f1..b2c21d5258f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java @@ -20,75 +20,75 @@ public class GNUMakefileUtil extends PosixMakefileUtil { public static boolean isInclude(String line) { line = line.trim(); - boolean isInclude = line.startsWith("include") && line.length() > 7 && Character.isWhitespace(line.charAt(7)); - boolean isDashInclude = line.startsWith("-include") && line.length() > 8 && Character.isWhitespace(line.charAt(8)); - boolean isSInclude = line.startsWith("sinclude") && line.length() > 8 && Character.isWhitespace(line.charAt(8)); + boolean isInclude = line.startsWith(GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 7 && Character.isWhitespace(line.charAt(7)); + boolean isDashInclude = line.startsWith("-" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); //$NON-NLS-1$ + boolean isSInclude = line.startsWith("s" + GNUMakefileConstants.DIRECTIVE_INCLUDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); //$NON-NLS-1$ return isInclude || isDashInclude || isSInclude; } public static boolean isVPath(String line) { line = line.trim(); - return line.equals("vpath") || line.startsWith("vpath") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + return line.equals(GNUMakefileConstants.DIRECTIVE_VPATH) || line.startsWith(GNUMakefileConstants.DIRECTIVE_VPATH) && line.length() > 5 && Character.isWhitespace(line.charAt(5)); } public static boolean isExport(String line) { line = line.trim(); - return line.equals("export") || line.startsWith("export") && line.length() > 6 && Character.isWhitespace(line.charAt(6)); + return line.equals(GNUMakefileConstants.VARIABLE_EXPORT) || line.startsWith(GNUMakefileConstants.VARIABLE_EXPORT) && line.length() > 6 && Character.isWhitespace(line.charAt(6)); } public static boolean isUnExport(String line) { line = line.trim(); - return line.startsWith("unexport") && line.length() > 8 && Character.isWhitespace(line.charAt(8)); + return line.startsWith(GNUMakefileConstants.DIRECTIVE_UNEXPORT) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); } public static boolean isDefine(String line) { line = line.trim(); - return line.startsWith("define") && line.length() > 6 && Character.isWhitespace(line.charAt(6)); + return line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE) && line.length() > 6 && Character.isWhitespace(line.charAt(6)); } public static boolean isEndef(String line) { - return line.trim().equals("endef"); + return line.trim().equals(GNUMakefileConstants.TERMINAL_ENDEF); } public static boolean isOverride(String line) { line = line.trim(); - return line.startsWith("override") && line.length() > 8 && Character.isWhitespace(line.charAt(8)); + return line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE) && line.length() > 8 && Character.isWhitespace(line.charAt(8)); } public static boolean isIfeq(String line) { line = line.trim(); - return line.startsWith("ifeq") && line.length() > 4 && Character.isWhitespace(line.charAt(4)); + return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFEQ) && line.length() > 4 && Character.isWhitespace(line.charAt(4)); } public static boolean isIfneq(String line) { line = line.trim(); - return line.startsWith("ifneq") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNEQ) && line.length() > 5 && Character.isWhitespace(line.charAt(5)); } public static boolean isIfdef(String line) { line = line.trim(); - return line.startsWith("ifdef") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFDEF) && line.length() > 5 && Character.isWhitespace(line.charAt(5)); } public static boolean isIfndef(String line) { line = line.trim(); - return line.startsWith("ifndef") && line.length() > 6 && Character.isWhitespace(line.charAt(6)); + return line.startsWith(GNUMakefileConstants.CONDITIONAL_IFNDEF) && line.length() > 6 && Character.isWhitespace(line.charAt(6)); } public static boolean isElse(String line) { - return line.trim().equals("else"); + return line.trim().equals(GNUMakefileConstants.CONDITIONAL_ELSE); } public static boolean isEndif(String line) { - return line.trim().equals("endif"); + return line.trim().equals(GNUMakefileConstants.TERMINAL_ENDIF); } public static boolean isOverrideDefine(String line) { line = line.trim(); - if (line.startsWith("override")) { + if (line.startsWith(GNUMakefileConstants.VARIABLE_OVERRIDE)) { int i = 8; for (; i < line.length() && Character.isWhitespace(line.charAt(i)); i++); - if (line.startsWith("define", i)) { + if (line.startsWith(GNUMakefileConstants.VARIABLE_DEFINE, i)) { return true; } } @@ -157,7 +157,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".PHONY"); + return line.equals(GNUMakefileConstants.RULE_PHONY); } return false; } @@ -167,7 +167,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".INTERMEDIATE"); + return line.equals(GNUMakefileConstants.RULE_INTERMEDIATE); } return false; } @@ -177,7 +177,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".SECONDARY"); + return line.equals(GNUMakefileConstants.RULE_SECONDARY); } return false; } @@ -187,7 +187,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".DELETE_ON_ERROR"); + return line.equals(GNUMakefileConstants.RULE_DELETE_ON_ERROR); } return false; } @@ -197,7 +197,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".LOW_RESOLUTION_TIME"); + return line.equals(GNUMakefileConstants.RULE_LOW_RESOLUTION_TIME); } return false; } @@ -207,7 +207,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".EXPORT_ALL_VARIABLES"); + return line.equals(GNUMakefileConstants.RULE_EXPORT_ALL_VARIABLES); } return false; } @@ -217,7 +217,7 @@ public class GNUMakefileUtil extends PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".NOTPARALLEL"); + return line.equals(GNUMakefileConstants.RULE_NOT_PARALLEL); } return false; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java index 71f4c82aede..87e79dfe293 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileValidator.java @@ -16,13 +16,14 @@ import java.io.InputStreamReader; import java.io.Reader; import org.eclipse.cdt.core.IMarkerGenerator; -import org.eclipse.cdt.make.core.makefile.*; import org.eclipse.cdt.make.core.makefile.IBadDirective; import org.eclipse.cdt.make.core.makefile.IDirective; +import org.eclipse.cdt.make.core.makefile.IMakefileValidator; import org.eclipse.cdt.make.core.makefile.ISpecialRule; import org.eclipse.cdt.make.core.makefile.gnu.IConditional; import org.eclipse.cdt.make.core.makefile.gnu.ITerminal; import org.eclipse.cdt.make.core.makefile.gnu.IVariableDefinition; +import org.eclipse.cdt.make.internal.core.makefile.MakefileMessages; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; @@ -48,7 +49,7 @@ public class GNUMakefileValidator implements IMakefileValidator { reporter = new IMarkerGenerator() { public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) { - String name = "Makefile"; + String name = "Makefile"; //$NON-NLS-1$ if (file != null) { name = file.getName(); } @@ -66,15 +67,15 @@ public class GNUMakefileValidator implements IMakefileValidator { public String getSeverity(int severity) { if (severity == IMarkerGenerator.SEVERITY_ERROR_BUILD) { - return "Error Build"; + return MakefileMessages.getString("MakefileValidator.errorBuild"); //$NON-NLS-1$ } else if (severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { - return "Error resource"; + return MakefileMessages.getString("MakefileValidator.errorResource"); //$NON-NLS-1$ } else if (severity == IMarkerGenerator.SEVERITY_INFO) { - return "Warning info"; + return MakefileMessages.getString("MakefileValidator.warningInfo"); //$NON-NLS-1$ } else if (severity == IMarkerGenerator.SEVERITY_WARNING) { - return "Warning"; + return MakefileMessages.getString("MakefileValidator.warning"); //$NON-NLS-1$ } - return "unknown"; + return MakefileMessages.getString("MakefileValidator.unknown"); //$NON-NLS-1$ } }; @@ -83,7 +84,7 @@ public class GNUMakefileValidator implements IMakefileValidator { } public void checkFile(IFile file, IProgressMonitor monitor) { - String message = "Checking file : " + file.getFullPath().toString(); + String message = MakefileMessages.getString("MakefileValidator.checkingFile") + file.getFullPath().toString(); //$NON-NLS-1$ monitor.subTask(message); GNUMakefile gnu = new GNUMakefile(); InputStream stream = null; @@ -102,7 +103,7 @@ public class GNUMakefileValidator implements IMakefileValidator { } } } - monitor.subTask("File checked"); + monitor.subTask(MakefileMessages.getString("MakefileValidator.fileChecked")); //$NON-NLS-1$ monitor.done(); } @@ -124,7 +125,7 @@ public class GNUMakefileValidator implements IMakefileValidator { if (conditionCount == 0) { // ERROR else missing conditon. int startLine = condition.getStartLine(); - String msg = "else missing if condition"; + String msg = MakefileMessages.getString("MakefileValidator.error.elseMissingIfCondition"); //$NON-NLS-1$ int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE; String varName = condition.toString().trim(); marker.addMarker(res, startLine, msg, severity, varName); @@ -136,7 +137,7 @@ public class GNUMakefileValidator implements IMakefileValidator { if (conditionCount == 0) { // ERROR missing condition. int startLine = terminal.getStartLine(); - String msg = "Endif missing if/else condition"; + String msg = MakefileMessages.getString("MakefileValidator.error.endifMissingIfElseCondition"); //$NON-NLS-1$ int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE; String varName = terminal.toString().trim(); marker.addMarker(res, startLine, msg, severity, varName); @@ -147,7 +148,7 @@ public class GNUMakefileValidator implements IMakefileValidator { if (defineCount == 0) { // ERROR missing define. int startLine = terminal.getStartLine(); - String msg = "endef missing [override] define"; + String msg = MakefileMessages.getString("MakefileValidator.error.endefMissingOverrideDefine"); //$NON-NLS-1$ int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE; String varName = terminal.toString().trim(); marker.addMarker(res, startLine, msg, severity, varName); @@ -163,7 +164,7 @@ public class GNUMakefileValidator implements IMakefileValidator { } else if (directive instanceof IBadDirective) { // ERROR unknow statement. int startLine = directive.getStartLine(); - String msg = "unknow directive"; + String msg = MakefileMessages.getString("MakefileValidator.error.unknownDirective"); //$NON-NLS-1$ int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE; String varName = directive.toString().trim(); marker.addMarker(res, startLine, msg, severity, varName); @@ -174,7 +175,7 @@ public class GNUMakefileValidator implements IMakefileValidator { if (conditionCount > 0) { // ERROR no matching endif for condition. int startLine = 0; - String varName = ""; + String varName = ""; //$NON-NLS-1$ int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE; for (int i = directives.length - 1; i >= 0; i--) { if (directives[i] instanceof IConditional) { @@ -183,13 +184,13 @@ public class GNUMakefileValidator implements IMakefileValidator { break; } } - String msg = "No matching endif for condition"; + String msg = MakefileMessages.getString("MakefileValidator.error.noMatchingEndifForCondition"); //$NON-NLS-1$ marker.addMarker(res, startLine, msg, severity, varName); } if (defineCount > 0) { // ERROR no matching endef for define. int startLine = 0; - String varName = ""; + String varName = ""; //$NON-NLS-1$ int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE; for (int i = directives.length - 1; i >= 0; i--) { if (directives[i] instanceof IVariableDefinition) { @@ -201,7 +202,7 @@ public class GNUMakefileValidator implements IMakefileValidator { } } } - String msg = "No matching endef for [override] define"; + String msg = MakefileMessages.getString("MakefileValidator.error.noMatchingEndefForOverrideDefine"); //$NON-NLS-1$ marker.addMarker(res, startLine, msg, severity, varName); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java index 57221482b6d..d5bf9685000 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUTargetRule.java @@ -55,7 +55,7 @@ public class GNUTargetRule extends TargetRule { } reqs = getOrderOnlyPrerequisites(); if (reqs.length > 0) { - buffer.append(" |"); + buffer.append(" |"); //$NON-NLS-1$ for (int i = 0; i < reqs.length; i++) { buffer.append(' ').append(reqs[i]); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java index b758e55e114..3a3ff24b725 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java @@ -14,9 +14,10 @@ import org.eclipse.cdt.make.internal.core.makefile.Directive; public class Ifdef extends Conditional { - + private static final String EMPTY = ""; //$NON-NLS-1$ + public Ifdef(Directive parent, String var) { - super(parent, var, "", ""); + super(parent, var, EMPTY, EMPTY); } public boolean isIfdef() { @@ -24,7 +25,7 @@ public class Ifdef extends Conditional { } public String toString() { - StringBuffer sb = new StringBuffer("ifdef"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFDEF); sb.append(' ').append(getVariable()); return sb.toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java index 194fc7ca349..434e1cfd605 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java @@ -24,7 +24,7 @@ public class Ifeq extends Conditional { } public String toString() { - StringBuffer sb = new StringBuffer("ifeq"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFEQ); sb.append(' ').append(getConditional()); return sb.toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java index 5cf40a36d31..8d900d35aa6 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java @@ -15,8 +15,9 @@ import org.eclipse.cdt.make.internal.core.makefile.Directive; public class Ifndef extends Conditional { + private static final String EMPTY = ""; //$NON-NLS-1$ public Ifndef(Directive parent, String var) { - super(parent, var, "", ""); + super(parent, var, EMPTY, EMPTY); } public boolean isIfndef() { @@ -24,7 +25,7 @@ public class Ifndef extends Conditional { } public String toString() { - StringBuffer sb = new StringBuffer("ifndef"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFNDEF); sb.append(' ').append(getVariable()); return sb.toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java index 84c04183a0b..a22d3682622 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java @@ -24,7 +24,7 @@ public class Ifneq extends Conditional { } public String toString() { - StringBuffer sb = new StringBuffer("ifneq"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.CONDITIONAL_IFNEQ); sb.append(' ').append(getConditional()); return sb.toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java index 85dda93900c..81e45e284fc 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.java @@ -29,7 +29,7 @@ public class Include extends Parent implements IInclude { } public String toString() { - StringBuffer sb = new StringBuffer("include"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_INCLUDE); for (int i = 0; i < filenames.length; i++) { sb.append(' ').append(filenames[i]); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/IntermediateRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/IntermediateRule.java index 9b632f73b2e..6e53df32409 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/IntermediateRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/IntermediateRule.java @@ -24,7 +24,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Target; public class IntermediateRule extends SpecialRule implements IIntermediateRule { public IntermediateRule(Directive parent, String[] reqs) { - super(parent, new Target(".INTERMEDIATE"), reqs, new Command[0]); + super(parent, new Target(GNUMakefileConstants.RULE_INTERMEDIATE), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/LowResolutionTimeRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/LowResolutionTimeRule.java index 9f7ad20c40a..27320ee1396 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/LowResolutionTimeRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/LowResolutionTimeRule.java @@ -25,7 +25,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Target; public class LowResolutionTimeRule extends SpecialRule implements ILowResolutionTimeRule { public LowResolutionTimeRule(Directive parent, String[] reqs) { - super(parent, new Target(".LOW_RESOLUTION_TIME"), reqs, new Command[0]); + super(parent, new Target(GNUMakefileConstants.RULE_LOW_RESOLUTION_TIME), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/NotParallelRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/NotParallelRule.java index ac03352be6c..69f4610945a 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/NotParallelRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/NotParallelRule.java @@ -27,7 +27,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Target; public class NotParallelRule extends SpecialRule implements INotParallelRule { public NotParallelRule(Directive parent, String[] reqs) { - super(parent, new Target(".NOTPARALLEL"), reqs, new Command[0]); + super(parent, new Target(GNUMakefileConstants.RULE_NOT_PARALLEL), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java index 2b429e8bef4..8262ed461b4 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java @@ -20,10 +20,10 @@ public class OverrideDefine extends DefineVariable { } public String toString() { - StringBuffer sb = new StringBuffer("override define "); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_OVERRIDE + " " + GNUMakefileConstants.VARIABLE_DEFINE); //$NON-NLS-1$ sb.append(getName()).append('\n'); sb.append(getValue()); - sb.append("endef"); + sb.append(GNUMakefileConstants.TERMINAL_ENDEF); return sb.toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/PhonyRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/PhonyRule.java index b9af5369072..7c20f2f3f1c 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/PhonyRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/PhonyRule.java @@ -25,7 +25,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Target; public class PhonyRule extends SpecialRule implements IPhonyRule { public PhonyRule(Directive parent, String[] reqs) { - super(parent, new Target(".PHONY"), reqs, new Command[0]); + super(parent, new Target(GNUMakefileConstants.RULE_PHONY), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/SecondaryRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/SecondaryRule.java index 9d7e455f786..6c11f8d502f 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/SecondaryRule.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/SecondaryRule.java @@ -27,7 +27,7 @@ import org.eclipse.cdt.make.internal.core.makefile.Target; public class SecondaryRule extends SpecialRule implements ISecondaryRule { public SecondaryRule(Directive parent, String[] reqs) { - super(parent, new Target(".SECONDARY"), reqs, new Command[0]); + super(parent, new Target(GNUMakefileConstants.RULE_SECONDARY), reqs, new Command[0]); } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java index f331ed904b2..935c21bb5a9 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Terminal.java @@ -13,7 +13,7 @@ package org.eclipse.cdt.make.internal.core.makefile.gnu; import org.eclipse.cdt.make.core.makefile.gnu.ITerminal; import org.eclipse.cdt.make.internal.core.makefile.Directive; -public class Terminal extends Directive implements ITerminal { +public abstract class Terminal extends Directive implements ITerminal { public Terminal(Directive parent) { super(parent); @@ -28,11 +28,6 @@ public class Terminal extends Directive implements ITerminal { } public String toString() { - if (isEndif()) { - return "endif\n"; - } else if (isEndef()){ - return "endef\n"; - } - return "\n"; + return "\n"; //$NON-NLS-1$ } } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java index 708a4dc34f3..f05f49f5a52 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java @@ -23,7 +23,7 @@ public class UnExport extends Directive implements IUnExport { } public String toString() { - StringBuffer sb = new StringBuffer("unexport"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_UNEXPORT); sb.append(' ').append(variable); return sb.toString(); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java index 55be12c5913..552360a9986 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java @@ -25,7 +25,7 @@ public class VPath extends Directive implements IVPath { } public String toString() { - StringBuffer sb = new StringBuffer("vpath"); + StringBuffer sb = new StringBuffer(GNUMakefileConstants.DIRECTIVE_VPATH); if (pattern != null && pattern.length() > 0) { sb.append(' ').append(pattern); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java index 214c5ef4005..e7ddf49e081 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VariableDefinition.java @@ -36,7 +36,7 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi } public VariableDefinition(Directive parent, String name, StringBuffer value, int type) { - this(parent, "", name, value, type); + this(parent, "", name, value, type); //$NON-NLS-1$ } public VariableDefinition(Directive parent, String target, String name, StringBuffer value, int type) { @@ -51,29 +51,32 @@ public class VariableDefinition extends MacroDefinition implements IVariableDefi public String toString() { StringBuffer sb = new StringBuffer(); if (isTargetSpecific()) { - sb.append(getTarget()).append(": "); + sb.append(getTarget()).append(": "); //$NON-NLS-1$ } if (isOverride()) { - sb.append("override "); + sb.append(GNUMakefileConstants.VARIABLE_OVERRIDE); } if (isMultiLine()) { - sb.append("define "); + sb.append(GNUMakefileConstants.VARIABLE_DEFINE); + sb.append(' '); sb.append(getName()).append('\n'); sb.append(getValue()).append('\n'); - sb.append("endef\n"); + sb.append(GNUMakefileConstants.TERMINAL_ENDEF); + sb.append('\n'); } else { if (isExport()) { - sb.append("export "); + sb.append(GNUMakefileConstants.VARIABLE_EXPORT); + sb.append(' '); } sb.append(getName()); if (isRecursivelyExpanded()) { - sb.append(" = "); + sb.append(" = "); //$NON-NLS-1$ } else if (isSimplyExpanded()) { - sb.append(" := "); + sb.append(" := "); //$NON-NLS-1$ } else if (isConditional()) { - sb.append(" ?= "); + sb.append(" ?= "); //$NON-NLS-1$ } else if (isAppend()) { - sb.append(" += "); + sb.append(" += "); //$NON-NLS-1$ } sb.append(getValue()).append('\n'); } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java index 13e4abe3c13..5c8345ccc55 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefile.java @@ -29,6 +29,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.MacroDefinition; +import org.eclipse.cdt.make.internal.core.makefile.MakeFileConstants; 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; @@ -199,7 +200,7 @@ public class PosixMakefile extends AbstractMakefile { */ public IDirective[] getBuiltins() { if (builtins == null) { - String location = "builtin" + File.separator + "posix.mk"; + String location = "builtin" + File.separator + "posix.mk"; //$NON-NLS-1$ //$NON-NLS-2$ try { InputStream stream = MakeCorePlugin.getDefault().openStream(new Path(location)); PosixMakefile gnu = new PosixMakefile(); @@ -238,19 +239,19 @@ public class PosixMakefile extends AbstractMakefile { keyword = line; reqs = new String[0]; } - if (".IGNORE".equals(keyword)) { + if (keyword.equals(MakeFileConstants.RULE_IGNORE)) { special = new IgnoreRule(this, reqs); - } else if (".POSIX".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_POSIX)) { special = new PosixRule(this); - } else if (".PRECIOUS".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_PRECIOUS)) { special = new PreciousRule(this, reqs); - } else if (".SILENT".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_SILENT)) { special = new SilentRule(this, reqs); - } else if (".SUFFIXES".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_SUFFIXES)) { special = new SuffixesRule(this, reqs); - } else if (".DEFAULT".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_DEFAULT)) { special = new DefaultRule(this, new Command[0]); - } else if (".SCCS_GET".equals(keyword)) { + } else if (keyword.equals(MakeFileConstants.RULE_SCCS_GET)) { special = new SccsGetRule(this, new Command[0]); } return special; @@ -282,7 +283,7 @@ public class PosixMakefile extends AbstractMakefile { value = line.substring(index + 1).trim(); } else { name = line; - value = ""; + value = ""; //$NON-NLS-1$ } return new MacroDefinition(this, name, new StringBuffer(value)); } @@ -328,7 +329,7 @@ public class PosixMakefile extends AbstractMakefile { public static void main(String[] args) { try { - String filename = "Makefile"; + String filename = "Makefile"; //$NON-NLS-1$ if (args.length == 1) { filename = args[0]; } diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefileUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefileUtil.java index f1539eaad4d..0331e870ab2 100644 --- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefileUtil.java +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/posix/PosixMakefileUtil.java @@ -13,6 +13,7 @@ package org.eclipse.cdt.make.internal.core.makefile.posix; import java.util.ArrayList; import java.util.List; +import org.eclipse.cdt.make.internal.core.makefile.MakeFileConstants; import org.eclipse.cdt.make.internal.core.makefile.Util; /** @@ -28,7 +29,7 @@ public class PosixMakefileUtil { int space; // Trim away trailing and prepending spaces. line = line.trim(); - while ((space = Util.indexOf(line, " \t")) != -1) { + while ((space = Util.indexOf(line, " \t")) != -1) { //$NON-NLS-1$ aList.add(line.substring(0, space).trim()); line = line.substring(space + 1).trim(); } @@ -57,11 +58,11 @@ public class PosixMakefileUtil { public static boolean isInferenceRule(String line) { line = line.trim(); - if (line.startsWith(".")) { + if (line.startsWith(".")) { //$NON-NLS-1$ int index = Util.indexOf(line, ':'); if (index > 1) { line = line.substring(index + 1).trim(); - if (line.length() == 0 || line.equals(";")) { + if (line.length() == 0 || line.equals(";")) { //$NON-NLS-1$ return true; } } @@ -74,7 +75,7 @@ public class PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".DEFAULT"); + return line.equals(MakeFileConstants.RULE_DEFAULT); } return false; } @@ -84,7 +85,7 @@ public class PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".IGNORE"); + return line.equals(MakeFileConstants.RULE_IGNORE); } return false; } @@ -94,7 +95,7 @@ public class PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".POSIX"); + return line.equals(MakeFileConstants.RULE_POSIX); } return false; } @@ -104,7 +105,7 @@ public class PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".PRECIOUS"); + return line.equals(MakeFileConstants.RULE_PRECIOUS); } return false; } @@ -114,7 +115,7 @@ public class PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".SCCS_GET"); + return line.equals(MakeFileConstants.RULE_SCCS_GET); } return false; } @@ -124,7 +125,7 @@ public class PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".SILENT"); + return line.equals(MakeFileConstants.RULE_SILENT); } return false; } @@ -134,7 +135,7 @@ public class PosixMakefileUtil { int colon = Util.indexOf(line, ':'); if (colon > 0) { line = line.substring(0, colon).trim(); - return line.equals(".SUFFIXES"); + return line.equals(MakeFileConstants.RULE_SUFFIXES); } return false; }