1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.github.maven_nar.cpptasks.ti;
21
22 import java.io.File;
23 import java.util.Vector;
24
25 import com.github.maven_nar.cpptasks.compiler.CommandLineLinker;
26 import com.github.maven_nar.cpptasks.compiler.LinkType;
27 import com.github.maven_nar.cpptasks.compiler.Linker;
28 import com.github.maven_nar.cpptasks.types.LibraryTypeEnum;
29
30
31
32
33
34
35
36
37 public class ClxxLinker extends CommandLineLinker {
38 private static final ClxxLinker cl55DllInstance = new ClxxLinker("lnk55", ".dll");
39 private static final ClxxLinker cl55Instance = new ClxxLinker("lnk55", ".exe");
40 private static final ClxxLinker cl6xDllInstance = new ClxxLinker("lnk6x", ".dll");
41 private static final ClxxLinker cl6xInstance = new ClxxLinker("lnk6x", ".exe");
42
43 public static ClxxLinker getCl55DllInstance() {
44 return cl55DllInstance;
45 }
46
47 public static ClxxLinker getCl55Instance() {
48 return cl55Instance;
49 }
50
51 public static ClxxLinker getCl6xDllInstance() {
52 return cl6xDllInstance;
53 }
54
55 public static ClxxLinker getCl6xInstance() {
56 return cl6xInstance;
57 }
58
59 private ClxxLinker(final String command, final String outputSuffix) {
60 super(command, "-h", new String[] {
61 ".o", ".lib", ".res"
62 }, new String[] {
63 ".map", ".pdb", ".lnk"
64 }, outputSuffix, false, null);
65 }
66
67 protected void addBase(final long base, final Vector<String> args) {
68 }
69
70 protected void addEntry(final String entry, final Vector<String> args) {
71 }
72
73 protected void addFixed(final Boolean fixed, final Vector<String> args) {
74 }
75
76 protected void addImpliedArgs(final boolean debug, final LinkType linkType, final Vector<String> args) {
77 if (linkType.isSharedLibrary()) {
78 args.addElement("-abs");
79 }
80 }
81
82 protected void addIncremental(final boolean incremental, final Vector<String> args) {
83 }
84
85 protected void addMap(final boolean map, final Vector<String> args) {
86 if (map) {
87 args.addElement("-m");
88 }
89 }
90
91 protected void addStack(final int stack, final Vector<String> args) {
92 }
93
94 @Override
95 protected String getCommandFileSwitch(final String commandFile) {
96 return "@" + commandFile;
97 }
98
99 @Override
100 public File[] getLibraryPath() {
101 return new File[0];
102 }
103
104 @Override
105 public String[] getLibraryPatterns(final String[] libnames, final LibraryTypeEnum libType) {
106
107
108
109 final String[] libpats = new String[libnames.length];
110 for (int i = 0; i < libnames.length; i++) {
111 libpats[i] = libnames[i] + ".o";
112 }
113 return libpats;
114 }
115
116 @Override
117 public Linker getLinker(final LinkType linkType) {
118 return this;
119 }
120
121 @Override
122 protected int getMaximumCommandLength() {
123 return 1024;
124 }
125
126 @Override
127 protected String[] getOutputFileSwitch(final String outputFile) {
128 return new String[] {
129 "-o", outputFile
130 };
131 }
132
133 @Override
134 public boolean isCaseSensitive() {
135
136 return false;
137 }
138 }