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.compaq;
21
22 import java.util.Vector;
23
24 import com.github.maven_nar.cpptasks.compiler.LinkType;
25 import com.github.maven_nar.cpptasks.compiler.Linker;
26 import com.github.maven_nar.cpptasks.msvc.MsvcCompatibleLinker;
27
28
29
30
31
32
33 public final class CompaqVisualFortranLinker extends MsvcCompatibleLinker {
34 private static final CompaqVisualFortranLinker dllLinker = new CompaqVisualFortranLinker(".dll");
35 private static final CompaqVisualFortranLinker instance = new CompaqVisualFortranLinker(".exe");
36
37 public static CompaqVisualFortranLinker getInstance() {
38 return instance;
39 }
40
41 private CompaqVisualFortranLinker(final String outputSuffix) {
42 super("DF", "__bogus__.xxx", outputSuffix);
43 }
44
45 protected void addImpliedArgs(final boolean debug, final LinkType linkType, final Vector<String> args) {
46 args.addElement("/NOLOGO");
47 final boolean staticRuntime = linkType.isStaticRuntime();
48 if (staticRuntime) {
49 args.addElement("/libs:static");
50 } else {
51 args.addElement("/libs:dll");
52 }
53 if (debug) {
54 args.addElement("/debug");
55 } else {
56 }
57 if (linkType.isSharedLibrary()) {
58 args.addElement("/dll");
59 } else {
60 args.addElement("/exe");
61 }
62 }
63
64 @Override
65 public Linker getLinker(final LinkType type) {
66 if (type.isStaticLibrary()) {
67 return CompaqVisualFortranLibrarian.getInstance();
68 }
69 if (type.isSharedLibrary()) {
70 return dllLinker;
71 }
72 return instance;
73 }
74
75 @Override
76 public String[] getOutputFileSwitch(final String outputFile) {
77 final StringBuffer buf = new StringBuffer("/OUT:");
78 if (outputFile.indexOf(' ') >= 0) {
79 buf.append('"');
80 buf.append(outputFile);
81 buf.append('"');
82 } else {
83 buf.append(outputFile);
84 }
85 return new String[] {
86 buf.toString()
87 };
88 }
89 }