baseOptions.append("# ADD BASE LINK32");
options.append("# ADD LINK32");
ProcessorConfiguration config = linkTarget.getConfiguration();
if (config instanceof CommandLineLinkerConfiguration) {
CommandLineLinkerConfiguration linkConfig =
(CommandLineLinkerConfiguration) config;
File[] linkSources = linkTarget.getAllSources();
for (int i = 0; i < linkSources.length; i++) {
//
// if file was not compiled or otherwise generated
//
if (targets.get(linkSources[i].getName()) == null) {
//
// if source appears to be a system library or object file
// just output the name of the file (advapi.lib for example)
// otherwise construct a relative path.
//
String relPath = linkSources[i].getName();
//
// check if file comes from a project dependency
// if it does it should not be explicitly linked
boolean fromDependency = false;
if (relPath.indexOf(".") > 0) {
String baseName = relPath.substring(0, relPath.indexOf("."));
for(Iterator iter = dependencies.iterator(); iter.hasNext(); ) {
DependencyDef depend = (DependencyDef) iter.next();
if (baseName.compareToIgnoreCase(depend.getName()) == 0) {
fromDependency = true;
}
}
}
if (!fromDependency) {
if (!CUtil.isSystemPath(linkSources[i])) {
relPath = CUtil.getRelativePath(basePath, linkSources[i]);
}
//
// if path has an embedded space then
// must quote
if (relPath.indexOf(' ') > 0) {
options.append(" \"");
options.append(CUtil.toWindowsPath(relPath));
options.append("\"");
} else {
options.append(' ');
options.append(CUtil.toWindowsPath(relPath));
}
}
}
}
String[] preArgs = linkConfig.getPreArguments();
for (int i = 0; i < preArgs.length; i++) {
if (isDebug || !preArgs[i].equals("/DEBUG")) {
options.append(' ');
options.append(preArgs[i]);
baseOptions.append(' ');
baseOptions.append(preArgs[i]);
}
}
String[] endArgs = linkConfig.getEndArguments();
for (int i = 0; i < endArgs.length; i++) {
options.append(' ');
options.append(endArgs[i]);
baseOptions.append(' ');
baseOptions.append(endArgs[i]);