From 3e86e80afd2c9858cf880c7bb5f257e09ae784d2 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Sun, 7 Sep 2003 19:42:06 +0000 Subject: [PATCH] Interface of the Makefile parser --- .../cdt/make/core/makefile/ICommand.java | 57 +++++++++++++++++++ .../cdt/make/core/makefile/IComment.java | 22 +++++++ .../cdt/make/core/makefile/IEmptyLine.java | 17 ++++++ .../make/core/makefile/IInferenceRule.java | 17 ++++++ .../make/core/makefile/IMacroDefinition.java | 21 +++++++ .../cdt/make/core/makefile/IMakefile.java | 28 +++++++++ .../eclipse/cdt/make/core/makefile/IRule.java | 29 ++++++++++ .../cdt/make/core/makefile/IStatement.java | 22 +++++++ .../cdt/make/core/makefile/ITarget.java | 19 +++++++ .../cdt/make/core/makefile/ITargetRule.java | 18 ++++++ 10 files changed, 250 insertions(+) create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IStatement.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java create mode 100644 build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITargetRule.java diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java new file mode 100644 index 00000000000..875e1eb0ffd --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ICommand.java @@ -0,0 +1,57 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + + +/** + * ICommand + */ +public interface ICommand extends IStatement { + + final public static char HYPHEN = '-'; + + final public static String HYPHEN_STRING = "-"; + + final public static char AT = '@'; + + final public static String AT_STRING = "@"; + + final public static char PLUS = '+'; + + final public static String PLUS_STRING = "+"; + + final public static char TAB = '\t'; + + /** + * - If the command prefix contains a hyphen, or the -i option is + * present, or the special target .IGNORE has either the current + * target as a prerequisite or has no prerequisites, any error + * found while executing the command will be ignored. + */ + boolean shouldIgnoreError(); + + /** + * @ If the command prefix contains an at sign and the + * command-line -n option is not specified, or the -s option is + * present, or the special target .SILENT has either the current + * target as a prerequisite or has no prerequisites, the command + * will not be written to standard output before it is executed. + */ + boolean shouldBeSilent(); + + /** + * + If the command prefix contains a plus sign, this indicates a + * command line that will be executed even if -n, -q or -t is + * specified. + */ + boolean shouldExecute(); + +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java new file mode 100644 index 00000000000..4af9fde950c --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IComment.java @@ -0,0 +1,22 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + * IComment + */ +public interface IComment extends IStatement { + + final public static char POUND = '#'; + + final public static String POUND_STRING = "#"; + +} diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java new file mode 100644 index 00000000000..2a481740292 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IEmptyLine.java @@ -0,0 +1,17 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + * IEmptyLine + */ +public interface IEmptyLine extends IStatement { +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java new file mode 100644 index 00000000000..a922a3e93f7 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IInferenceRule.java @@ -0,0 +1,17 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + * IInferenceRule + */ +public interface IInferenceRule extends IRule { +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java new file mode 100644 index 00000000000..41a2e508724 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMacroDefinition.java @@ -0,0 +1,21 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + * IMacroDefinition + */ +public interface IMacroDefinition extends IStatement { + + public abstract String getName(); + + public abstract String getValue(); +} diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java new file mode 100644 index 00000000000..28004f1f627 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IMakefile.java @@ -0,0 +1,28 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + + +/** + * IMakefile + */ +public interface IMakefile { + IStatement[] getStatements(); + IRule[] getRules(); + IRule[] getRule(String target); + IInferenceRule[] getInferenceRules(); + IInferenceRule[] getInferenceRule(String target); + ITargetRule[] getTargetRules(); + ITargetRule[] getTargetRule(String target); + IMacroDefinition[] getMacroDefinitions(); + IMacroDefinition[] getMacroDefinition(String name); + IStatement[] getBuiltins(); +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java new file mode 100644 index 00000000000..2edec5edec1 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IRule.java @@ -0,0 +1,29 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + * There are two kinds of rules: Inference rules and target rules + */ +public interface IRule extends IStatement { + /** + * Array of command for the rule. + * @return + */ + ICommand[] getCommands(); + + /** + * The rule target name. + * @return + */ + ITarget getTarget(); + +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IStatement.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IStatement.java new file mode 100644 index 00000000000..4cfe39aabf8 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/IStatement.java @@ -0,0 +1,22 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + */ +public interface IStatement { + + int getStartLine(); + + int getEndLine(); + + String toString(); +} diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java new file mode 100644 index 00000000000..84b1825b456 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITarget.java @@ -0,0 +1,19 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + * ITarget + */ +public interface ITarget { + String toString(); + boolean isUptodate(); +} \ No newline at end of file diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITargetRule.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITargetRule.java new file mode 100644 index 00000000000..3377ce6058b --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/makefile/ITargetRule.java @@ -0,0 +1,18 @@ +/********************************************************************** + * Copyright (c) 2002,2003 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.make.core.makefile; + +/** + * ITargetRule + */ +public interface ITargetRule extends IRule { + ITarget[] getDependencies(); +} \ No newline at end of file