Update cpptaks to support LIBPATH and INCLUDEPATH which will defined in TOOLS_DEF file.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1754 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong 2006-10-16 07:34:13 +00:00
parent aa197375d8
commit 51f9486371
2 changed files with 46 additions and 10 deletions

View File

@ -220,20 +220,36 @@ public class CommandLineUserDefine {
// }
// project.log(logLine.toString(), Project.MSG_VERBOSE);
int retval = 0;
Environment newEnv = new Environment();
if (userdefine.getDpath() == null || userdefine.getDpath().trim().length() == 0) {
retval = runCommand(cctask, workdir, cmd, null);
} else {
String existPath = System.getenv(getPathName());
Environment newEnv = new Environment();
if (userdefine.getDpath() != null && userdefine.getDpath().trim().length() != 0) {
String existPath = System.getenv(getPathName("PATH"));
Variable var = new Variable();
var.setKey(getPathName());
var.setKey(getPathName("PATH"));
var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath));
newEnv.addVariable(var);
retval = runCommand(cctask, workdir, cmd, newEnv);
}
if (userdefine.getLibpath() != null && userdefine.getLibpath().trim().length() != 0) {
String existPath = System.getenv(getPathName("LIB"));
Variable var = new Variable();
var.setKey(getPathName("LIB"));
var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath));
newEnv.addVariable(var);
}
if (userdefine.getInclude() != null && userdefine.getInclude().trim().length() != 0) {
String existPath = System.getenv(getPathName("INCLUDE"));
Variable var = new Variable();
var.setKey(getPathName("INCLUDE"));
var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath));
newEnv.addVariable(var);
}
int retval = runCommand(cctask, workdir, cmd, newEnv);
if (retval != 0) {
throw new BuildException(userdefine.getCmd()
@ -242,7 +258,7 @@ public class CommandLineUserDefine {
}
}
private String getPathName() {
private String getPathName(String variableName) {
if (pathName != null) {
return pathName;
}
@ -250,7 +266,7 @@ public class CommandLineUserDefine {
Iterator iter = allEnv.keySet().iterator();
while (iter.hasNext()) {
String key = (String)iter.next();
if(key.equalsIgnoreCase("PATH")) {
if(key.equalsIgnoreCase(variableName)) {
pathName = key;
break ;
}

View File

@ -63,6 +63,10 @@ public class UserDefineDef extends ProcessorDef {
private Vector allLibraries = new Vector();
private String dpath = null;
private String libpath = null;
private String include = null;
public void addLibset(LibrarySet libset) {
if (isReference()) {
@ -310,4 +314,20 @@ public class UserDefineDef extends ProcessorDef {
this.dpath = dpath;
}
public String getLibpath() {
return libpath;
}
public void setLibpath(String libpath) {
this.libpath = libpath;
}
public String getInclude() {
return include;
}
public void setInclude(String include) {
this.include = include;
}
}