diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Define.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Define.java new file mode 100644 index 00000000000..ddbd7ca460f --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Define.java @@ -0,0 +1,49 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakefileUtil; +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Define extends Statement { + + String variable; + + public Define(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("define"); + sb.append(' ').append(variable); + return sb.toString(); + } + + public String getVariable() { + return variable; + } + + /** + * Format of the include directive: + * export Variabe ... + */ + protected void parse(String line) { + line = line.trim(); + for (int i = 0; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + line = line.substring(i).trim(); + break; + } + } + variable = line; + } +} 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 new file mode 100644 index 00000000000..2af6d11de13 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Else.java @@ -0,0 +1,25 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Else extends Statement { + + + public Else() { + } + + public String toString() { + return "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 new file mode 100644 index 00000000000..95b25d95bf7 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endef.java @@ -0,0 +1,25 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Endef extends Statement { + + + public Endef() { + } + + public String toString() { + return "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 new file mode 100644 index 00000000000..68c81718ee0 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Endif.java @@ -0,0 +1,25 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Endif extends Statement { + + + public Endif() { + } + + public String toString() { + return "endif"; + } +} diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Export.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Export.java new file mode 100644 index 00000000000..7f50e3bf559 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Export.java @@ -0,0 +1,55 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import java.util.StringTokenizer; + +import org.eclipse.cdt.make.internal.core.makefile.Statement; + +public class Export extends Statement { + + String variable; + + public Export(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("export"); + sb.append(' ').append(variable); + return sb.toString(); + } + + public String getVariable() { + return variable; + } + + /** + * Format of the include directive: + * export Variabe ... + */ + protected void parse(String line) { + StringTokenizer st = new StringTokenizer(line); + int count = st.countTokens(); + if (count > 0) { + for (int i = 0; i < count; i++) { + if (i == 0) { + // ignore the "export" keyword. + continue; + } + variable = st.nextToken(); + } + } + if (variable == null) { + variable = new String(); + } + } +} 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 new file mode 100644 index 00000000000..8d236e8e9b6 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefile.java @@ -0,0 +1,43 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; + +import org.eclipse.cdt.make.core.makefile.IStatement; +import org.eclipse.cdt.make.internal.core.makefile.MakefileReader; +import org.eclipse.cdt.make.internal.core.makefile.posix.PosixMakefile; + +/** + * GNUMakefile + */ +public class GNUMakefile extends PosixMakefile { + + public static String PATH_SEPARATOR = System.getProperty("path.separator", ":"); + + public GNUMakefile(String name) throws IOException { + this(new FileReader(name)); + } + + public GNUMakefile(Reader reader) throws IOException { + this(new MakefileReader(reader)); + } + + public GNUMakefile(MakefileReader reader) throws IOException { + super(reader); + } + + protected IStatement processLine(String line, int startLine, int endLine) { + return null; + } +} 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 new file mode 100644 index 00000000000..9a7810aadf7 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/GNUMakefileUtil.java @@ -0,0 +1,98 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +/** + * GNUMakefile + */ +public class GNUMakefileUtil { + + public static boolean isIncludeDirective(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)); + return isInclude || isDashInclude || isSInclude; + } + + public static boolean isVPathDirective(String line) { + line = line.trim(); + return line.equals("vpath") || + line.startsWith("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)); + } + + public static boolean isUnExport(String line) { + line = line.trim(); + return line.equals("unexport") || + line.startsWith("unexport") && line.length() > 8 && Character.isWhitespace(line.charAt(8)); + } + + public static boolean isDefine(String line) { + line = line.trim(); + return line.equals("define") || + line.startsWith("define") && line.length() > 6 && Character.isWhitespace(line.charAt(6)); + } + + public static boolean isEndef(String line) { + line = line.trim(); + return line.equals("endef") || + line.startsWith("endef") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + } + + public static boolean isOverride(String line) { + line = line.trim(); + return line.equals("override") || + line.startsWith("override") && line.length() > 8 && Character.isWhitespace(line.charAt(8)); + } + + public static boolean isIfeq(String line) { + line = line.trim(); + return line.equals("ifeq") || + line.startsWith("ifeq") && line.length() > 4 && Character.isWhitespace(line.charAt(4)); + } + + public static boolean isIfneq(String line) { + line = line.trim(); + return line.equals("ifneq") || + line.startsWith("ifneq") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + } + + public static boolean isIfdef(String line) { + line = line.trim(); + return line.equals("ifdef") || + line.startsWith("ifdef") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + } + + public static boolean isIfndef(String line) { + line = line.trim(); + return line.equals("ifndef") || + line.startsWith("ifndef") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + } + + public static boolean isElse(String line) { + line = line.trim(); + return line.equals("else") || + line.startsWith("else") && line.length() > 4 && Character.isWhitespace(line.charAt(4)); + } + + public static boolean isEndif(String line) { + line = line.trim(); + return line.equals("endif") || + line.startsWith("endif") && line.length() > 5 && Character.isWhitespace(line.charAt(5)); + } + +} 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 new file mode 100644 index 00000000000..cf7b8004b47 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifdef.java @@ -0,0 +1,49 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakefileUtil; +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Ifdef extends Statement { + + String variable; + + public Ifdef(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("ifdef"); + sb.append(' ').append(variable); + return sb.toString(); + } + + public String getVariable() { + return variable; + } + + /** + * Format of the include directive: + * ifeq condional-directive + */ + protected void parse(String line) { + line = line.trim(); + for (int i = 0; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + line = line.substring(i).trim(); + break; + } + } + variable = line; + } +} 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 new file mode 100644 index 00000000000..381ccc930d8 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifeq.java @@ -0,0 +1,50 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakefileUtil; +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Ifeq extends Statement { + + String conditional; + + public Ifeq(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("ifeq"); + sb.append(' ').append(conditional); + return sb.toString(); + } + + public String getConditional() { + return conditional; + } + + /** + * Format of the include directive: + * ifeq condional-directive + */ + protected void parse(String line) { + line = line.trim(); + for (int i = 0; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + line = line.substring(i).trim(); + break; + } + } + + conditional = line; + } +} 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 new file mode 100644 index 00000000000..16091f4aff7 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifndef.java @@ -0,0 +1,49 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakefileUtil; +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Ifndef extends Statement { + + String variable; + + public Ifndef(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("ifndef"); + sb.append(' ').append(variable); + return sb.toString(); + } + + public String getVariable() { + return variable; + } + + /** + * Format of the include directive: + * ifeq condional-directive + */ + protected void parse(String line) { + line = line.trim(); + for (int i = 0; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + line = line.substring(i).trim(); + break; + } + } + variable = line; + } +} 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 new file mode 100644 index 00000000000..617f60d1577 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Ifneq.java @@ -0,0 +1,49 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakefileUtil; +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Ifneq extends Statement { + + String conditional; + + public Ifneq(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("ifneq"); + sb.append(' ').append(conditional); + return sb.toString(); + } + + public String getConditional() { + return conditional; + } + + /** + * Format of the include directive: + * ifeq condional-directive + */ + protected void parse(String line) { + line = line.trim(); + for (int i = 0; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + line = line.substring(i).trim(); + break; + } + } + conditional = line; + } +} 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 new file mode 100644 index 00000000000..900388c3cf8 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Include.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.internal.core.makefile.gnu; + +import java.util.StringTokenizer; + +import org.eclipse.cdt.make.internal.core.makefile.Statement; + +public class Include extends Statement { + + String[] filenames; + + public Include(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("include"); + for (int i = 0; i < filenames.length; i++) { + sb.append(' ').append(filenames[i]); + } + return sb.toString(); + } + + public String[] getFilenames() { + return filenames; + } + + /** + * Format of the include directive: + * include filename1 filename2 ... + */ + protected void parse(String line) { + StringTokenizer st = new StringTokenizer(line); + int count = st.countTokens(); + if (count > 0) { + filenames = new String[count - 1]; + for (int i = 0; i < count; i++) { + if (i == 0) { + // ignore the "include" keyword. + continue; + } + filenames[i] = st.nextToken(); + } + } else { + filenames = new String[0]; + } + } +} diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Override.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Override.java new file mode 100644 index 00000000000..3ce2cdeca82 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/Override.java @@ -0,0 +1,54 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakefileUtil; +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class Override extends Statement { + + String variable; + + public Override(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("override"); + sb.append(' ').append(variable); + return sb.toString(); + } + + public String getVariable() { + return variable; + } + + /** + * Format: + * override VARIABLE := VALUE + */ + protected void parse(String line) { + int i = 0; + line = line.trim(); + for (; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + break; + } + } + + if (i < line.length()) { + variable = line.substring(i).trim(); + } else { + variable = new String(); + } + } +} 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 new file mode 100644 index 00000000000..ed259346645 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/OverrideDefine.java @@ -0,0 +1,60 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import org.eclipse.cdt.make.internal.core.makefile.MakefileUtil; +import org.eclipse.cdt.make.internal.core.makefile.Statement; + + +public class OverrideDefine extends Statement { + + String variable; + + public OverrideDefine(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("override define"); + sb.append(' ').append(variable); + return sb.toString(); + } + + public String getVariable() { + return variable; + } + + /** + * Format: + * override define VARIABLE + */ + protected void parse(String line) { + line = line.trim(); + + // Pass over "override" + for (int i = 0; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + line = line.substring(i).trim(); + break; + } + } + + // Pass over "define" + for (int i = 0; i < line.length(); i++) { + if (MakefileUtil.isSpace(line.charAt(i))) { + line = line.substring(i).trim(); + break; + } + } + + variable = line; + } +} 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 new file mode 100644 index 00000000000..0bd6061e912 --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/UnExport.java @@ -0,0 +1,55 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import java.util.StringTokenizer; + +import org.eclipse.cdt.make.internal.core.makefile.Statement; + +public class UnExport extends Statement { + + String variable; + + public UnExport(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("unexport"); + sb.append(' ').append(variable); + return sb.toString(); + } + + public String getVariable() { + return variable; + } + + /** + * Format of the include directive: + * export Variabe ... + */ + protected void parse(String line) { + StringTokenizer st = new StringTokenizer(line); + int count = st.countTokens(); + if (count > 0) { + for (int i = 0; i < count; i++) { + if (i == 0) { + // ignore the "unexport" keyword. + continue; + } + variable = st.nextToken(); + } + } + if (variable == null) { + variable = new String(); + } + } +} 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 new file mode 100644 index 00000000000..91a093f269b --- /dev/null +++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/makefile/gnu/VPath.java @@ -0,0 +1,86 @@ +/********************************************************************** + * 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.internal.core.makefile.gnu; + +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import org.eclipse.cdt.make.internal.core.makefile.Statement; + +public class VPath extends Statement { + + String pattern; + String[] directories; + + public VPath(String line) { + parse(line); + } + + public String toString() { + StringBuffer sb = new StringBuffer("vpath"); + if (pattern != null && pattern.length() > 0) { + sb.append(' ').append(pattern); + } + for (int i = 0; i < directories.length; i++) { + sb.append(' ').append(directories[i]); + } + return sb.toString(); + } + + public String[] getDirectories() { + return directories; + } + + public String getPattern() { + return pattern; + } + + /** + * There are three forms of the "vpath" directive: + * "vpath PATTERN DIRECTORIES" + * Specify the search path DIRECTORIES for file names that match PATTERN. + * + * The search path, DIRECTORIES, is a list of directories to be + * searched, separated by colons (semi-colons on MS-DOS and + * MS-Windows) or blanks, just like the search path used in the `VPATH' variable. + * + * "vpath PATTERN" + * Clear out the search path associated with PATTERN. + * + * "vpath" + * Clear all search paths previously specified with `vpath' directives. + */ + protected void parse(String line) { + StringTokenizer st = new StringTokenizer(line); + int count = st.countTokens(); + List dirs = new ArrayList(count); + if (count > 0) { + for (int i = 0; i < count; i++) { + if (count == 0) { + // ignore the "vpath" directive + st.nextToken(); + } else if (count == 1) { + pattern = st.nextToken(); + } else if (count == 3) { + String delim = " \t\n\r\f" + GNUMakefile.PATH_SEPARATOR; + dirs.add(st.nextToken(delim)); + } else { + dirs.add(st.nextToken()); + } + } + } + directories = (String[]) dirs.toArray(new String[0]); + if (pattern == null) { + pattern = new String(); + } + } +}