Here's a patch for fpmkunit.

- implements Defaults.NoFPCCfg in TBuildEngine.GetCompilerCommand
- added ttCleanOnlyUnit in TTarget.GetCleanFiles
- fixes a dirty little bug in TBuildEngine.GetCompilerCommand (compile filename)

To come back to the last item;

When fpmake is called from a deeper directory normally Installer.Directory is set. This directory in turn is appended to Target.FullSourceFileName. When you also set TTarget.Directory it can result in a pathfilename like: mydir\..\src\lib.pas. This at least is invalid on windows. By expanding the filename and then making it relative again against the package directory it's solved.

Oh yes, in relation to fpmake I seem to have discovered a bug in ExtractRelativepath as well (http://www.freepascal.org/mantis/view.php?id=10224).

Darius
Index: src/fpmkunit.pp
===================================================================
--- src/fpmkunit.pp	(revision 9304)
+++ src/fpmkunit.pp	(working copy)
@@ -3326,7 +3326,12 @@
 begin
   PD:=GetPackageDir(APackage,True);
 
-  Result := '-n';
+  Result := '';
+
+  //compiler configuration
+  if Defaults.NoFPCCfg then
+    Result := '-n';
+
   // Compile mode
   If Target.Mode<>cmFPC then
     Result:=Result+' -M'+ModeToString(Target.Mode)
@@ -3366,7 +3371,7 @@
   If (Target.Options<>'') then
     Result:=Result+' '+Target.Options;
   // Add Filename to compile
-  Result:=Result+' '+Target.FullSourceFileName;
+  Result:=Result+' '+ExtractRelativePath(PD, ExpandFileName(Target.FullSourceFileName));
 end;
 
 
@@ -4128,7 +4133,7 @@
   If not(ACPU in CPUs) or not(AOS in OSes) then
     exit;
   List.Add(APrefixU + ObjectFileName);
-  If (TargetType in [ttUnit,ttImplicitUnit,ttExampleUnit]) then
+  If (TargetType in [ttUnit,ttImplicitUnit,ttExampleUnit, ttCleanOnlyUnit]) then
     List.Add(APrefixU + UnitFileName)
   else If (TargetType in [ttProgram,ttExampleProgram]) then
     List.Add(APrefixB + GetProgramFileName(AOS));
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to