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.openwatcom;
21
22 import java.io.File;
23 import java.io.IOException;
24 import java.util.Vector;
25
26 import com.github.maven_nar.cpptasks.CUtil;
27 import com.github.maven_nar.cpptasks.TargetMatcher;
28 import com.github.maven_nar.cpptasks.VersionInfo;
29 import com.github.maven_nar.cpptasks.compiler.CommandLineLinker;
30 import com.github.maven_nar.cpptasks.compiler.LinkType;
31 import com.github.maven_nar.cpptasks.platforms.WindowsPlatform;
32 import com.github.maven_nar.cpptasks.types.LibraryTypeEnum;
33
34
35
36
37
38
39 public abstract class OpenWatcomLinker extends CommandLineLinker {
40
41
42
43
44
45
46
47
48 protected OpenWatcomLinker(final String command, final String outputSuffix) {
49 super(command, "-r", new String[] {
50 ".obj", ".lib", ".res"
51 }, new String[] {
52 ".map", ".pdb", ".lnk"
53 }, outputSuffix, false, null);
54 }
55
56
57
58
59
60
61
62
63
64 protected final void addBase(final long base, final Vector<String> args) {
65 }
66
67
68
69
70
71
72
73
74
75 protected final void addEntry(final String entry, final Vector<String> args) {
76 }
77
78
79
80
81
82
83
84
85
86 protected final void addFixed(final Boolean fixed, final Vector<String> args) {
87 }
88
89
90
91
92
93
94
95
96
97
98
99 protected final void addImpliedArgs(final boolean debug, final LinkType linkType, final Vector<String> args) {
100 if (linkType.isExecutable()) {
101 if (linkType.isSubsystemConsole()) {
102 args.addElement("/bc");
103 } else {
104 if (linkType.isSubsystemGUI()) {
105 args.addElement("/bg");
106 }
107 }
108 }
109 if (linkType.isSharedLibrary()) {
110 args.addElement("/bd");
111 }
112 }
113
114
115
116
117
118
119
120
121
122 protected final void addIncremental(final boolean incremental, final Vector<String> args) {
123 }
124
125
126
127
128
129
130
131
132
133 protected final void addMap(final boolean map, final Vector<String> args) {
134 if (map) {
135 args.addElement("/fm");
136 }
137 }
138
139
140
141
142
143
144
145
146
147 protected final void addStack(final int stack, final Vector<String> args) {
148 if (stack >= 0) {
149 final String stackStr = Integer.toString(stack);
150 args.addElement("/k" + stackStr);
151 }
152 }
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173 @Override
174 public final void addVersionFiles(final VersionInfo versionInfo, final LinkType linkType, final File outputFile,
175 final boolean isDebug, final File objDir, final TargetMatcher matcher) throws IOException {
176 WindowsPlatform.addVersionFiles(versionInfo, linkType, outputFile, isDebug, objDir, matcher);
177 }
178
179
180
181
182
183
184
185
186 @Override
187 public final String getCommandFileSwitch(final String commandFile) {
188 return "@" + commandFile;
189 }
190
191
192
193
194
195
196 @Override
197 public final File[] getLibraryPath() {
198 return CUtil.getPathFromEnvironment("LIB", ";");
199 }
200
201
202
203
204
205
206
207
208
209
210 @Override
211 public final String[] getLibraryPatterns(final String[] libnames, final LibraryTypeEnum libType) {
212 return OpenWatcomProcessor.getLibraryPatterns(libnames, libType);
213 }
214
215
216
217
218
219
220 @Override
221 public final int getMaximumCommandLength() {
222 return 1024;
223 }
224
225
226
227
228
229
230
231
232 @Override
233 public final String[] getOutputFileSwitch(final String outFile) {
234 return OpenWatcomProcessor.getOutputFileSwitch(outFile);
235 }
236
237
238
239
240
241
242 @Override
243 public final boolean isCaseSensitive() {
244 return OpenWatcomProcessor.isCaseSensitive();
245 }
246
247 }