/* * Copyright (c) 2008 Embedded Brains GmbH and others. * * Embedded Brains GmbH * Obere Lagerstr. 30 * D-82178 Puchheim * Germany * rtems@embedded-brains.de * * All rights reserved. This program and the accompanying materials are made * available under the terms of the Eclipse Public License Version 1.0 ("EPL") * which accompanies this distribution and is available at * * http://www.eclipse.org/legal/epl-v10.html * * For purposes of the EPL, "Program" will mean the Content. * * Contributors: * * Sebastian Huber (Embedded Brains GmbH) - Initial API and implementation. */ package org.rtems.cdt; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import org.eclipse.core.runtime.IPath; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; public class Activator extends AbstractUIPlugin { private static Activator mPlugin; public void start(BundleContext context) throws Exception { super.start(context); mPlugin = this; createBSPInfoMakefile(); } public void stop(BundleContext context) throws Exception { mPlugin = null; super.stop(context); } public static Activator getDefault() { return mPlugin; } public IPath getMakefileLocation() { return getStateLocation(); } private void createBSPInfoMakefile() { IPath makefile = getMakefileLocation().append("Makefile"); BufferedWriter out = null; try { out = new BufferedWriter(new FileWriter(makefile.toFile())); out.write( "include $(" + Constants.BSP_PATH_MAKE_VARIABLE + ")/Makefile.inc\n" + "include $(RTEMS_CUSTOM)\n" + "include $(PROJECT_ROOT)/make/leaf.cfg\n" + "all:\n" + "\t@echo " + Constants.TOOL_ARCHIVER_KEY + "\n" + "\t@for i in $(AR) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" + "\t@echo " + Constants.TOOL_ASSEMBLER_KEY + "\n" + "\t@for i in $(AS) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" + "\t@echo " + Constants.TOOL_COMPILER_C_KEY + "\n" + "\t@for i in $(COMPILE.c) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" + "\t@echo " + Constants.TOOL_COMPILER_CPP_KEY + "\n" + "\t@for i in $(COMPILE.cc) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" + "\t@echo " + Constants.TOOL_LINKER_C_KEY + "\n" + "\t@for i in $(LINK.c) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" + "\t@echo " + Constants.TOOL_LINKER_CPP_KEY + "\n" + "\t@for i in $(LINK.cc) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" ); } catch (IOException e) { e.printStackTrace(); } finally { try { if (out != null) { out.close(); } } catch (IOException e) { e.printStackTrace(); } } } }