1 | /* |
---|
2 | * Copyright (c) 2008 |
---|
3 | * Embedded Brains GmbH |
---|
4 | * Obere Lagerstr. 30 |
---|
5 | * D-82178 Puchheim |
---|
6 | * Germany |
---|
7 | * rtems@embedded-brains.de |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be found in the file |
---|
10 | * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. |
---|
11 | */ |
---|
12 | |
---|
13 | package org.rtems.cdt; |
---|
14 | |
---|
15 | import java.io.BufferedWriter; |
---|
16 | import java.io.FileWriter; |
---|
17 | import java.io.IOException; |
---|
18 | import org.eclipse.core.runtime.IPath; |
---|
19 | import org.eclipse.ui.plugin.AbstractUIPlugin; |
---|
20 | import org.osgi.framework.BundleContext; |
---|
21 | |
---|
22 | public class Activator extends AbstractUIPlugin { |
---|
23 | private static Activator mPlugin; |
---|
24 | |
---|
25 | public void start( BundleContext context) throws Exception { |
---|
26 | super.start( context); |
---|
27 | mPlugin = this; |
---|
28 | createBSPInfoMakefile(); |
---|
29 | } |
---|
30 | |
---|
31 | public void stop( BundleContext context) throws Exception { |
---|
32 | mPlugin = null; |
---|
33 | super.stop( context); |
---|
34 | } |
---|
35 | |
---|
36 | public static Activator getDefault() { |
---|
37 | return mPlugin; |
---|
38 | } |
---|
39 | |
---|
40 | public IPath getMakefileLocation() { |
---|
41 | return getStateLocation(); |
---|
42 | } |
---|
43 | |
---|
44 | private void createBSPInfoMakefile() { |
---|
45 | IPath makefile = getMakefileLocation().append( "Makefile"); |
---|
46 | BufferedWriter out = null; |
---|
47 | try { |
---|
48 | out = new BufferedWriter( new FileWriter( makefile.toFile())); |
---|
49 | out.write( |
---|
50 | "include $(" + Constants.BSP_PATH_MAKE_VARIABLE + ")/Makefile.inc\n" |
---|
51 | + "include $(RTEMS_CUSTOM)\n" |
---|
52 | + "include $(PROJECT_ROOT)/make/leaf.cfg\n" |
---|
53 | + "all:\n" |
---|
54 | + "\t@echo " + Constants.TOOL_ARCHIVER_KEY + "\n" |
---|
55 | + "\t@for i in $(AR) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" |
---|
56 | + "\t@echo " + Constants.TOOL_ASSEMBLER_KEY + "\n" |
---|
57 | + "\t@for i in $(AS) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" |
---|
58 | + "\t@echo " + Constants.TOOL_COMPILER_C_KEY + "\n" |
---|
59 | + "\t@for i in $(COMPILE.c) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" |
---|
60 | + "\t@echo " + Constants.TOOL_COMPILER_CPP_KEY + "\n" |
---|
61 | + "\t@for i in $(COMPILE.cc) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" |
---|
62 | + "\t@echo " + Constants.TOOL_LINKER_C_KEY + "\n" |
---|
63 | + "\t@for i in $(LINK.c) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" |
---|
64 | + "\t@echo " + Constants.TOOL_LINKER_CPP_KEY + "\n" |
---|
65 | + "\t@for i in $(LINK.cc) ; do printf \"\\t%s\\n\" \"$$i\" ; done\n" |
---|
66 | ); |
---|
67 | } catch (IOException e) { |
---|
68 | e.printStackTrace(); |
---|
69 | } finally { |
---|
70 | try { |
---|
71 | if (out != null) { |
---|
72 | out.close(); |
---|
73 | } |
---|
74 | } catch (IOException e) { |
---|
75 | e.printStackTrace(); |
---|
76 | } |
---|
77 | } |
---|
78 | } |
---|
79 | } |
---|