mirror of
https://github.com/danog/gllvm.git
synced 2024-11-26 21:24:42 +01:00
Issue #17 procedural abstraction.
This commit is contained in:
parent
307ea19e10
commit
c69bace9eb
@ -120,6 +120,21 @@ func Extract(args []string) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func resolveTool(defaultPath string, envPath string, usrPath *string) (path string) {
|
||||||
|
if *usrPath != "" {
|
||||||
|
path = *usrPath
|
||||||
|
} else {
|
||||||
|
if LLVMToolChainBinDir != "" {
|
||||||
|
if envPath != "" {
|
||||||
|
path = filepath.Join(LLVMToolChainBinDir, envPath)
|
||||||
|
} else {
|
||||||
|
path = filepath.Join(LLVMToolChainBinDir, defaultPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func parseSwitches() (ea extractionArgs) {
|
func parseSwitches() (ea extractionArgs) {
|
||||||
ea = extractionArgs{
|
ea = extractionArgs{
|
||||||
LinkerName: "llvm-link",
|
LinkerName: "llvm-link",
|
||||||
@ -147,29 +162,9 @@ func parseSwitches() (ea extractionArgs) {
|
|||||||
ea.SortBitcodeFiles = *sortBitcodeFilesPtr
|
ea.SortBitcodeFiles = *sortBitcodeFilesPtr
|
||||||
ea.BuildBitcodeArchive = *buildBitcodeArchive
|
ea.BuildBitcodeArchive = *buildBitcodeArchive
|
||||||
|
|
||||||
if *archiverNamePtr != "" {
|
ea.ArchiverName = resolveTool(ea.ArchiverName, LLVMARName, archiverNamePtr)
|
||||||
ea.ArchiverName = *archiverNamePtr
|
|
||||||
} else {
|
|
||||||
if LLVMToolChainBinDir != "" {
|
|
||||||
if LLVMARName != "" {
|
|
||||||
ea.ArchiverName = filepath.Join(LLVMToolChainBinDir, LLVMARName)
|
|
||||||
} else {
|
|
||||||
ea.ArchiverName = filepath.Join(LLVMToolChainBinDir, ea.ArchiverName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if *linkerNamePtr != "" {
|
ea.LinkerName = resolveTool(ea.LinkerName, LLVMLINKName, linkerNamePtr)
|
||||||
ea.LinkerName = *linkerNamePtr
|
|
||||||
} else {
|
|
||||||
if LLVMToolChainBinDir != "" {
|
|
||||||
if LLVMLINKName != "" {
|
|
||||||
ea.LinkerName = filepath.Join(LLVMToolChainBinDir, LLVMLINKName)
|
|
||||||
} else {
|
|
||||||
ea.LinkerName = filepath.Join(LLVMToolChainBinDir, ea.LinkerName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ea.OutputFile = *outputFilePtr
|
ea.OutputFile = *outputFilePtr
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user