}
protected String[] addLibrarySets(CCTask task, LibrarySet[] libsets,
Vector<String> preargs, Vector<String> midargs, Vector<String> endargs) {
Vector<String> libnames = new Vector<String>();
super.addLibrarySets(task, libsets, preargs, midargs, endargs);
LibraryTypeEnum previousLibraryType = null;
for (int i = 0; i < libsets.length; i++) {
LibrarySet set = libsets[i];
File libdir = set.getDir(null);
String[] libs = set.getLibs();
if (libdir != null) {
String relPath = libdir.getAbsolutePath();
//File outputFile = task.getOutfile();
File currentDir = new File(".");
if (currentDir != null && currentDir.getParentFile() != null) {
relPath = CUtil.getRelativePath(
currentDir.getParentFile().getAbsolutePath(), libdir);
}
if (set.getType() != null &&
"framework".equals(set.getType().getValue()) &&
isDarwin()) {
endargs.addElement("-F" + relPath);
} else {
endargs.addElement("-L" + relPath);
}
}
//
// if there has been a change of library type
//
if (set.getType() != previousLibraryType) {
if (set.getType() != null && "static".equals(set.getType().getValue())) {
// BEGINFREEHEP not on MacOS X
if (!isDarwin()) {
endargs.addElement(getStaticLibFlag());
previousLibraryType = set.getType();
}
//ENDFREEHEP
} else {
// FREEHEP not on MacOS X, recheck this!
if (set.getType() == null ||
!"framework".equals(set.getType().getValue()) &&
!isDarwin()) {
endargs.addElement(getDynamicLibFlag());
previousLibraryType = set.getType();
}
}
}
StringBuffer buf = new StringBuffer("-l");
if (set.getType() != null &&
"framework".equals(set.getType().getValue()) &&
isDarwin()) {
buf.setLength(0);
// FREEHEP, added as endarg w/o trailing space to avoid quoting!
endargs.addElement("-framework");
}
int initialLength = buf.length();
for (int j = 0; j < libs.length; j++) {
//
// reset the buffer to just "-l"
//
buf.setLength(initialLength);
//
// add the library name
buf.append(libs[j]);
libnames.addElement(libs[j]);
//
// add the argument to the list
endargs.addElement(buf.toString());
}
}
// BEGINFREEHEP if last was -Bstatic reset it to -Bdynamic so that libc and libm can be found as shareables
if ((previousLibraryType != null) && previousLibraryType.getValue().equals("static") && !isDarwin()) {
endargs.addElement(getDynamicLibFlag());
}
// ENDFREEHEP
String rc[] = new String[libnames.size()];