1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Fix bug 163094.

This commit is contained in:
Ken Ryall 2007-01-03 16:29:12 +00:00
parent f0b1c4ed80
commit f1dab8c58e

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others. * Copyright (c) 2002, 2006, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Nokia - Bug 163094
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.make.core; package org.eclipse.cdt.make.core;
@ -41,6 +42,7 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences;
@ -146,27 +148,26 @@ public class MakeCorePlugin extends Plugin {
return (String[])v.toArray(new String[v.size()]); return (String[])v.toArray(new String[v.size()]);
} }
public IMakefile createMakefile(IFile file) {
// static public IMakefile createMakefile(File file, boolean isGnuStyle, String[] makefileDirs) {
// base on a preference to chose GNU vs Posix
IMakefile makefile; IMakefile makefile;
if (isMakefileGNUStyle()) { if (isGnuStyle) {
GNUMakefile gnu = new GNUMakefile(); GNUMakefile gnu = new GNUMakefile();
ArrayList includeList = new ArrayList(); ArrayList includeList = new ArrayList();
includeList.addAll(Arrays.asList(gnu.getIncludeDirectories())); includeList.addAll(Arrays.asList(gnu.getIncludeDirectories()));
includeList.addAll(Arrays.asList(getMakefileDirs())); includeList.addAll(Arrays.asList(makefileDirs));
includeList.add(file.getLocation().removeLastSegments(1).toOSString()); includeList.add(new Path(file.getAbsolutePath()).removeLastSegments(1).toOSString());
String[] includes = (String[]) includeList.toArray(new String[includeList.size()]); String[] includes = (String[]) includeList.toArray(new String[includeList.size()]);
gnu.setIncludeDirectories(includes); gnu.setIncludeDirectories(includes);
try { try {
gnu.parse(file.getLocation().toOSString()); gnu.parse(file.getAbsolutePath());
} catch (IOException e) { } catch (IOException e) {
} }
makefile = gnu; makefile = gnu;
} else { } else {
PosixMakefile posix = new PosixMakefile(); PosixMakefile posix = new PosixMakefile();
try { try {
posix.parse(file.getLocation().toOSString()); posix.parse(file.getAbsolutePath());
} catch (IOException e) { } catch (IOException e) {
} }
makefile = posix; makefile = posix;
@ -174,6 +175,11 @@ public class MakeCorePlugin extends Plugin {
return makefile; return makefile;
} }
public IMakefile createMakefile(IFile file) {
return createMakefile(file.getLocation().toFile(), isMakefileGNUStyle(),
getMakefileDirs());
}
public void stop(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception {
try { try {
if ( fTargetManager != null) { if ( fTargetManager != null) {