From 5531ac8c912e42c1d14fc9aa99680579ec897101 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 15 Jan 2007 17:21:38 +0000 Subject: [PATCH] * fixed -o for sharedlibrary git-svn-id: trunk@5991 - --- compiler/finput.pas | 46 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/compiler/finput.pas b/compiler/finput.pas index 10602556c0..0fd6646d9e 100644 --- a/compiler/finput.pas +++ b/compiler/finput.pas @@ -603,8 +603,7 @@ uses procedure tmodulebase.setfilename(const fn:string;allowoutput:boolean); var - p,n,e, - extension, + p,n, prefix, suffix : string; begin @@ -624,7 +623,6 @@ uses paramallowoutput := allowoutput; p := FixPath(ExtractFilePath(fn),false); n := FixFileName(ChangeFileExt(ExtractFileName(fn),'')); - e := ExtractFileExt(fn); { set path } path:=stringdup(p); { obj,asm,ppu names } @@ -640,23 +638,6 @@ uses asmfilename:=stringdup(p+n+target_info.asmext); objfilename:=stringdup(p+n+target_info.objext); ppufilename:=stringdup(p+n+target_info.unitext); - { lib and exe could be loaded with a file specified with -o } - prefix := target_info.sharedlibprefix; - suffix := ''; - extension := target_info.sharedlibext; - - if AllowOutput and (compile_level=1) then - begin - if OutputFileName <> '' then - n:=OutputFileName; - if Assigned(OutputPrefix) then - prefix := OutputPrefix^; - if Assigned(OutputSuffix) then - suffix := OutputSuffix^; - if ExtractFileExt(OutputFileName) <> '' then - extension := ExtractFileExt(OutputFileName); - end; - importlibfilename:=stringdup(p+target_info.staticClibprefix+'imp'+n+target_info.staticlibext); staticlibfilename:=stringdup(p+target_info.staticlibprefix+n+target_info.staticlibext); @@ -665,13 +646,28 @@ uses p:=OutputExeDir else p:=path^; - sharedlibfilename:=stringdup(p+prefix+n+suffix+extension); - { don't use extension alone to check, it can be empty !! } - if (OutputFileName<>'')then - exefilename:=stringdup(p+OutputFileName) + { lib and exe could be loaded with a file specified with -o } + if AllowOutput and + (compile_level=1) and + (OutputFileName<>'')then + begin + exefilename:=stringdup(p+OutputFileName); + sharedlibfilename:=stringdup(p+OutputFileName); + end else - exefilename:=stringdup(p+n+target_info.exeext); + begin + exefilename:=stringdup(p+n+target_info.exeext); + if Assigned(OutputPrefix) then + prefix := OutputPrefix^ + else + prefix := target_info.sharedlibprefix; + if Assigned(OutputSuffix) then + suffix := OutputSuffix^ + else + suffix := ''; + sharedlibfilename:=stringdup(p+prefix+n+suffix+target_info.sharedlibext); + end; mapfilename:=stringdup(p+n+'.map'); end;