Source Code Cross Referenced for Main.java in  » 6.0-JDK-Modules » j2me » makedep » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » makedep 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *   
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package makedep;
028:
029:        // This program reads an include file database.
030:        // The database should cover each self .c and .h file,
031:        //   but not files in /usr/include
032:        // The database consists of pairs of nonblank words, where the first word is
033:        //   the filename that needs to include the file named by the second word.
034:        // For each .c file, this program generates a fooIncludes.h file that 
035:        //  the .c file may include to include all the needed files in the right order.
036:        // It also generates a foo.dep file to include in the makefile.
037:        // Finally it detects cycles, and can work with two files, an old and a new one.
038:        // To incrementally write out only needed files after a small change.
039:        //
040:        //  Added PREFIX, {DEP/INC}_DIR, smaller dep output  10/92  -Urs
041:
042:        // Add something for precompiled headers
043:
044:        // To handle different platforms, I am introducing a platform file.
045:        // The platform file contains lines like:
046:        // os = svr4
047:        //
048:        // Then, when processing the includeDB file, a token such as <os>
049:        // gets replaced by svr4. -- dmu 3/25/97
050:
051:        // Modified to centralize Dependencies to speed up make -- dmu 5/97
052:
053:        import java.util.*;
054:        import util.*;
055:
056:        public class Main {
057:
058:            static void usage() {
059:                System.out.print(usage_string);
060:            }
061:
062:            static final String usage_string = "Usage:\n"
063:                    + "makeDeps platform-name platform-file database-file [MakeDeps args]\n"
064:                    + "    [platform args]\n"
065:                    + "\n"
066:                    + "Supported values for platform-name: \n"
067:                    + "    WinGammaPlatform, WinCEGammaPlatform, UnixPlatform\n"
068:                    + "\n"
069:                    + "MakeDeps args:\n"
070:                    + "  -firstFile [filename]: Specify the first file in link order (i.e.,\n"
071:                    + "   to have a well-known function at the start of the output file)\n"
072:                    + "  -lastFile [filename]: Specify the last file in link order (i.e.,\n"
073:                    + "   to have a well-known function at the end of the output file)\n"
074:                    + "  -checkIncludeDB: Disable precompiled headers and/or source file merging\n"
075:                    + "   to check if includeDB has missing entries\n";
076:
077:            public static void main(String[] args) throws Throwable {
078:                try {
079:                    if (args.length < 3) {
080:                        usage();
081:                        System.exit(1);
082:                    }
083:
084:                    int argc = 0;
085:
086:                    String platformName = args[argc++];
087:                    Class platformClass = Class.forName("makedep."
088:                            + platformName);
089:
090:                    String plat1 = null;
091:                    String db1 = null;
092:                    String plat2 = null;
093:                    String db2 = null;
094:
095:                    String firstFile = null;
096:                    String lastFile = null;
097:                    boolean resolveVpath = false;
098:                    int sourceMergerLimit = 0;
099:                    boolean checkIncludeDB = false;
100:                    String workspace = null;
101:                    String genDir = null;
102:                    Properties globalProps = new Properties();
103:                    getEnableFlags(globalProps);
104:
105:                    int numOptionalArgs = (args.length - 3);
106:                    if (numOptionalArgs < 0) {
107:                        usage();
108:                        System.exit(1);
109:                    }
110:
111:                    plat1 = args[argc++];
112:                    db1 = args[argc++];
113:
114:                    // argc now points at start of optional arguments, if any
115:
116:                    try {
117:                        boolean gotOne = true;
118:                        while (gotOne && (argc <= args.length - 1)) {
119:                            String arg = args[argc];
120:                            if (arg.equals("-firstFile")) {
121:                                firstFile = args[argc + 1];
122:                                argc += 2;
123:                            } else if (arg.equals("-lastFile")) {
124:                                lastFile = args[argc + 1];
125:                                argc += 2;
126:                            } else if (arg.equals("-resolveVpath")) {
127:                                resolveVpath = args[argc + 1].equals("true");
128:                                argc += 2;
129:                            } else if (arg.equals("-checkIncludeDB")) {
130:                                checkIncludeDB = true;
131:                                argc += 1;
132:                            } else if (arg.equals("-sourceMergerLimit")) {
133:                                // Merge multiple .cpp files into a single .cpp file to speed
134:                                // up GCC compilation. For more info, see 
135:                                // Database.createMergedOuterFiles()
136:                                try {
137:                                    sourceMergerLimit = Integer
138:                                            .parseInt(args[argc + 1]);
139:                                } catch (Throwable t) {
140:                                    System.err
141:                                            .println("invalid integer value \""
142:                                                    + args[argc + 1]
143:                                                    + "\" for -sourceMergerLimit");
144:                                    System.exit(-1);
145:                                }
146:                                argc += 2;
147:                            } else if (arg.equals("-workspace")) {
148:                                workspace = args[argc + 1];
149:                                argc += 2;
150:                            } else if (arg.equals("-gendir")) {
151:                                genDir = args[argc + 1];
152:                                argc += 2;
153:                            } else if (arg.indexOf('=') != -1) {
154:                                String propName = arg.substring(0, arg
155:                                        .indexOf('='));
156:                                String propValue = arg.substring(arg
157:                                        .indexOf('=') + 1);
158:                                globalProps.setProperty(propName, propValue);
159:                                argc++;
160:                            } else {
161:                                gotOne = false;
162:                            }
163:                        }
164:                    } catch (Exception e) {
165:                        e.printStackTrace();
166:                        usage();
167:                        System.exit(1);
168:                    }
169:
170:                    Platform platform = (Platform) platformClass.newInstance();
171:                    if (checkIncludeDB) {
172:                        System.out.println("\n***\n");
173:                        System.out
174:                                .println("checking include DB -- precompiled headers/"
175:                                        + "merged sources disabled");
176:                        System.out.println("\n***");
177:                        platform.setUsePrecompiledHeader(false);
178:                    } else {
179:                        platform.setUsePrecompiledHeader(true);
180:                    }
181:                    platform.setupFileTemplates();
182:                    long t = platform.defaultGrandIncludeThreshold();
183:
184:                    String[] platformArgs = null;
185:                    int numPlatformArgs = args.length - argc;
186:                    if (numPlatformArgs > 0) {
187:                        platformArgs = new String[numPlatformArgs];
188:                        int offset = argc;
189:                        while (argc < args.length) {
190:                            platformArgs[argc - offset] = args[argc];
191:                            ++argc;
192:                        }
193:                    }
194:
195:                    // If you want to change the threshold, change the default
196:                    // "grand include" threshold in Platform.java, or override
197:                    // it in the platform-specific file like UnixPlatform.java
198:
199:                    Database previous = new Database(platform, t);
200:                    Database current = new Database(platform, t);
201:
202:                    previous.canBeMissing();
203:
204:                    if (firstFile != null) {
205:                        previous.setFirstFile(firstFile);
206:                        current.setFirstFile(firstFile);
207:                    }
208:                    if (lastFile != null) {
209:                        previous.setLastFile(lastFile);
210:                        current.setLastFile(lastFile);
211:                    }
212:                    previous.setResolveVpath(resolveVpath);
213:                    current.setResolveVpath(resolveVpath);
214:                    if (checkIncludeDB) {
215:                        sourceMergerLimit = 0;
216:                    }
217:                    previous.setSourceMergerLimit(sourceMergerLimit);
218:                    current.setSourceMergerLimit(sourceMergerLimit);
219:
220:                    if (workspace != null) {
221:                        previous.setWorkspace(workspace);
222:                        current.setWorkspace(workspace);
223:                    }
224:                    if (genDir != null) {
225:                        previous.setGenDir(genDir);
226:                        current.setGenDir(genDir);
227:                    }
228:
229:                    if (resolveVpath) {
230:                        if (workspace == null) {
231:                            System.out.println("-resolveVpath is set but "
232:                                    + "-workspace is not set");
233:                            usage();
234:                            System.exit(1);
235:                        }
236:                    }
237:
238:                    current.get(plat1, db1, globalProps);
239:                    current.compute();
240:                    current.put();
241:
242:                    if (platformArgs != null) {
243:                        // Allow the platform to write platform-specific files
244:                        platform.writePlatformSpecificFiles(previous, current,
245:                                platformArgs);
246:                    }
247:                } catch (Exception e) {
248:                    e.printStackTrace();
249:                }
250:            }
251:
252:            static void getEnableFlags(Properties globalProps) throws Throwable {
253:                Hashtable env = Util.getenv();
254:                boolean verbose = (env.get("VERBOSE") != null);
255:
256:                for (Enumeration e = env.keys(); e.hasMoreElements();) {
257:                    String key = (String) e.nextElement();
258:                    if (key.startsWith("ENABLE_") && !key.endsWith("__BY")) {
259:                        String propName = key;
260:                        String propValue = (String) env.get(key);
261:                        globalProps.setProperty(propName, propValue);
262:                        if (verbose) {
263:                            System.out.println(propName + " = " + propValue);
264:                        }
265:                    }
266:                }
267:            }
268:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.