View Javadoc

1   /*
2    * #%L
3    * Native ARchive plugin for Maven
4    * %%
5    * Copyright (C) 2002 - 2014 NAR Maven Plugin developers.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   * http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  // FREEHEP
21  package com.github.maven_nar.cpptasks.intel;
22  
23  import com.github.maven_nar.cpptasks.compiler.LinkType;
24  import com.github.maven_nar.cpptasks.compiler.Linker;
25  import com.github.maven_nar.cpptasks.gcc.AbstractLdLinker;
26  import com.github.maven_nar.cpptasks.gcc.GccLibrarian;
27  
28  public final class IntelLinux32CLinker extends AbstractLdLinker {
29    private static final String[] discardFiles = new String[0];
30    private static final String[] libtoolObjFiles = new String[] {
31        ".fo", ".a", ".lib", ".dll", ".so", ".sl"
32    };
33    private static final String[] objFiles = new String[] {
34        ".o", ".a", ".lib", ".dll", ".so", ".sl"
35    };
36    private static final IntelLinux32CLinker dllLinker = new IntelLinux32CLinker("lib", ".so", false,
37        new IntelLinux32CLinker("lib", ".so", true, null));
38    private static final IntelLinux32CLinker instance = new IntelLinux32CLinker("", "", false, null);
39  
40    public static IntelLinux32CLinker getInstance() {
41      return instance;
42    }
43  
44    private IntelLinux32CLinker(final String outputPrefix, final String outputSuffix, final boolean isLibtool,
45        final IntelLinux32CLinker libtoolLinker) {
46      super("icc", "-V", objFiles, discardFiles, outputPrefix, outputSuffix, isLibtool, libtoolLinker);
47    }
48  
49    @Override
50    public Linker getLinker(final LinkType type) {
51      if (type.isStaticLibrary()) {
52        return GccLibrarian.getInstance();
53      }
54      if (type.isSharedLibrary()) {
55        return dllLinker;
56      }
57      return instance;
58    }
59  }