source: rtems-eclipse-plug-in/org.rtems.cdt.toolchain2/org/rtems/cdt/Activator.java @ c1a000b

Last change on this file since c1a000b was c1a000b, checked in by Sebastian Huber <sebastian.huber@…>, on 12/03/08 at 14:59:50

Reverted previous change. You must translate the path manually for Cygwin.
TODO: Fix for MinGW.

  • Property mode set to 100644
File size: 2.3 KB
Line 
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
13package org.rtems.cdt;
14
15import java.io.BufferedWriter;
16import java.io.FileWriter;
17import java.io.IOException;
18import org.eclipse.core.runtime.IPath;
19import org.eclipse.ui.plugin.AbstractUIPlugin;
20import org.osgi.framework.BundleContext;
21
22public 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}
Note: See TracBrowser for help on using the repository browser.