mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-10-31 11:13:53 +01:00 
			
		
		
		
	Support two more attribute LIBPATH and INCLUDEPATH in tools_def file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1761 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		
							parent
							
								
									8270b34d9d
								
							
						
					
					
						commit
						c639781ef0
					
				| @ -45,8 +45,6 @@ public class CommandLineUserDefine { | |||||||
| 
 | 
 | ||||||
|     String outputDelimiter = null; |     String outputDelimiter = null; | ||||||
|      |      | ||||||
|     private static String pathName = null; |  | ||||||
|      |  | ||||||
|     public void command(CCTask cctask, UserDefineDef userdefine) { |     public void command(CCTask cctask, UserDefineDef userdefine) { | ||||||
|         boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC"); |         boolean isGccCommand = userdefine.getFamily().equalsIgnoreCase("GCC"); | ||||||
|         File workdir; |         File workdir; | ||||||
| @ -222,30 +220,48 @@ public class CommandLineUserDefine { | |||||||
| 
 | 
 | ||||||
|         Environment newEnv = new Environment(); |         Environment newEnv = new Environment(); | ||||||
|          |          | ||||||
|  |         // | ||||||
|  |         // Prepare for environment variable PATH | ||||||
|  |         // | ||||||
|         if (userdefine.getDpath() != null && userdefine.getDpath().trim().length() != 0) { |         if (userdefine.getDpath() != null && userdefine.getDpath().trim().length() != 0) { | ||||||
|             String existPath = System.getenv(getPathName("PATH")); |             String pathName = getPathName("PATH"); | ||||||
|  |             String existPath = System.getenv(pathName); | ||||||
|              |              | ||||||
|             Variable var = new Variable(); |             Variable var = new Variable(); | ||||||
|             var.setKey(getPathName("PATH")); |             var.setKey(pathName); | ||||||
|             var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath)); |             var.setPath(new Path(project, userdefine.getDpath() + ";" + existPath)); | ||||||
|             newEnv.addVariable(var); |             newEnv.addVariable(var); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|  |         // | ||||||
|  |         // Prepare for environment variable LIB | ||||||
|  |         // | ||||||
|         if (userdefine.getLibpath() != null && userdefine.getLibpath().trim().length() != 0) { |         if (userdefine.getLibpath() != null && userdefine.getLibpath().trim().length() != 0) { | ||||||
|             String existPath = System.getenv(getPathName("LIB")); |             String pathName = getPathName("LIB"); | ||||||
|              |             String existPath = System.getenv(pathName); | ||||||
|             Variable var = new Variable(); |             Variable var = new Variable(); | ||||||
|             var.setKey(getPathName("LIB")); |             var.setKey(pathName); | ||||||
|             var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath)); |             if (existPath == null) { | ||||||
|  |                 var.setPath(new Path(project, userdefine.getLibpath())); | ||||||
|  |             } else { | ||||||
|  |                 var.setPath(new Path(project, userdefine.getLibpath() + ";" + existPath)); | ||||||
|  |             } | ||||||
|             newEnv.addVariable(var); |             newEnv.addVariable(var); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|  |         // | ||||||
|  |         // Prepare for environment variable INCLUDE | ||||||
|  |         // | ||||||
|         if (userdefine.getInclude() != null && userdefine.getInclude().trim().length() != 0) { |         if (userdefine.getInclude() != null && userdefine.getInclude().trim().length() != 0) { | ||||||
|             String existPath = System.getenv(getPathName("INCLUDE")); |             String pathName = getPathName("INCLUDE"); | ||||||
|              |             String existPath = System.getenv(pathName); | ||||||
|             Variable var = new Variable(); |             Variable var = new Variable(); | ||||||
|             var.setKey(getPathName("INCLUDE")); |             var.setKey(pathName); | ||||||
|             var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath)); |             if (existPath == null) { | ||||||
|  |                 var.setPath(new Path(project, userdefine.getInclude())); | ||||||
|  |             } else { | ||||||
|  |                 var.setPath(new Path(project, userdefine.getInclude() + ";" + existPath)); | ||||||
|  |             } | ||||||
|             newEnv.addVariable(var); |             newEnv.addVariable(var); | ||||||
|         } |         } | ||||||
|          |          | ||||||
| @ -259,19 +275,15 @@ public class CommandLineUserDefine { | |||||||
|     } |     } | ||||||
|      |      | ||||||
|     private String getPathName(String variableName) { |     private String getPathName(String variableName) { | ||||||
|         if (pathName != null) { |  | ||||||
|             return pathName; |  | ||||||
|         } |  | ||||||
|         Map allEnv = System.getenv(); |         Map allEnv = System.getenv(); | ||||||
|         Iterator iter = allEnv.keySet().iterator(); |         Iterator iter = allEnv.keySet().iterator(); | ||||||
|         while (iter.hasNext()) { |         while (iter.hasNext()) { | ||||||
|             String key = (String)iter.next(); |             String key = (String)iter.next(); | ||||||
|             if(key.equalsIgnoreCase(variableName)) { |             if(key.equalsIgnoreCase(variableName)) { | ||||||
|                 pathName = key; |                 return key; | ||||||
|                 break ; |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return pathName; |         return variableName; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     protected int runCommand(CCTask task, File workingDir, String[] cmdline, Environment env) |     protected int runCommand(CCTask task, File workingDir, String[] cmdline, Environment env) | ||||||
|  | |||||||
| @ -543,6 +543,28 @@ public class GenBuildTask extends Ant { | |||||||
|             } else { |             } else { | ||||||
|                 getProject().setProperty(cmd[m] + "_DPATH", ""); |                 getProject().setProperty(cmd[m] + "_DPATH", ""); | ||||||
|             } |             } | ||||||
|  |              | ||||||
|  |             // | ||||||
|  |             // Set CC_LIBPATH | ||||||
|  |             // | ||||||
|  |             key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_LIBPATH; | ||||||
|  |             String libpath = GlobalData.getCommandSetting(key, fpdModuleId); | ||||||
|  |             if (libpath != null) { | ||||||
|  |                 getProject().setProperty(cmd[m] + "_LIBPATH", libpath.replaceAll("(\\\\)", "/")); | ||||||
|  |             } else { | ||||||
|  |                 getProject().setProperty(cmd[m] + "_LIBPATH", ""); | ||||||
|  |             } | ||||||
|  |              | ||||||
|  |             // | ||||||
|  |             // Set CC_INCLUDEPATH | ||||||
|  |             // | ||||||
|  |             key[4] = ToolDefinitions.TOOLS_DEF_ATTRIBUTE_INCLUDEPATH; | ||||||
|  |             String includepath = GlobalData.getCommandSetting(key, fpdModuleId); | ||||||
|  |             if (dpath != null) { | ||||||
|  |                 getProject().setProperty(cmd[m] + "_INCLUDEPATH", includepath.replaceAll("(\\\\)", "/")); | ||||||
|  |             } else { | ||||||
|  |                 getProject().setProperty(cmd[m] + "_INCLUDEPATH", ""); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user