PageRenderTime 374ms CodeModel.GetById 193ms app.highlight 7ms RepoModel.GetById 173ms app.codeStats 0ms

/src/org/ooc/frontend/compilers/Gcc.java

http://github.com/nddrylliog/ooc
Java | 93 lines | 68 code | 20 blank | 5 comment | 1 complexity | 41bc3a23ba4a9926c5931c5e0a1e3e9e MD5 | raw file
 1package org.ooc.frontend.compilers;
 2
 3/**
 4 * Gnu Compilers Collection 
 5 * 
 6 * @author Amos Wenger
 7 */
 8public class Gcc extends BaseCompiler {
 9
10	public Gcc() {
11		super("gcc");
12	}
13	
14	public Gcc(String executableName) {
15		super(executableName);
16	}
17
18	public void addDynamicLibrary(String library) {
19		command.add("-l"+library);
20	}
21
22	public void addIncludePath(String path) {
23		command.add("-I"+path);
24	}
25
26	public void addLibraryPath(String path) {
27		command.add("-L"+path);
28	}
29
30	public void addObjectFile(String file) {
31		command.add(file);
32	}
33
34	public void addOption(String option) {
35		command.add(option);
36	}
37
38	public void setOutputPath(String path) {
39		command.add("-o");
40		command.add(path);
41	}
42
43	public void setCompileOnly() {
44		command.add("-c");
45	}
46
47	public void setDebugEnabled() {
48		command.add("-g");
49	}
50	
51	@Override
52	public void reset() {
53		super.reset();
54		command.add("-std=gnu99");
55		command.add("-Wall");
56        command.add("-O2");
57	}
58
59	public boolean supportsDeclInFor() {
60		return true;
61	}
62
63	public boolean supportsVLAs() {
64		return true;
65	}
66	
67	@Override
68	public Gcc clone() {
69		return new Gcc();
70	}
71
72	public void defineSymbol(String symbolName) {
73		command.add("-D" + symbolName);
74	}
75
76	public void undefineSymbol(String symbolName) {
77		command.add("-U" + symbolName);		
78	}
79
80	public void setFatArchitectures(String[] archs) {
81		for (String arch: archs) {
82			command.add("-arch");
83			command.add(arch);
84		}
85	}
86	
87	public void setOSXSDKAndDeploymentTarget(String version) {
88		command.add("-isysroot");
89		command.add("/Developer/SDKs/MacOSX" + version + ".sdk");
90		command.add("-mmacosx-version-min=" + version);
91	}
92	
93}