Browse Source

make clean deletes pas2js.o in FPCDIR

mattias 1 year ago
parent
commit
074e193e0a
2 changed files with 16 additions and 8 deletions
  1. 5 7
      README.md
  2. 11 1
      fpmake.pp

+ 5 - 7
README.md

@@ -37,7 +37,8 @@ as well if it has the latest version.
 ### Complete checkout
 ### Complete checkout
 
 
 The makefile expects the sources of FPC to be present under the `compiler` directory.
 The makefile expects the sources of FPC to be present under the `compiler` directory.
-You can copy/clone the FPC sources there. Note that a symlink to the FPC sources will not work, as the linker confuses some relative paths.
+You can copy/clone the FPC sources there or set enviroment variable FPCDIR.
+Note that a symlink to the FPC sources will not work, as the linker confuses some relative paths.
 
 
 Cloning pas2js and fpc git repos:
 Cloning pas2js and fpc git repos:
 
 
@@ -50,7 +51,7 @@ cd compiler
 git config --local pull.rebase true
 git config --local pull.rebase true
 ```
 ```
 
 
-Update local git repos:
+Updating local git repos:
 ```sh
 ```sh
 cd pas2js
 cd pas2js
 git pull
 git pull
@@ -58,7 +59,6 @@ cd compiler
 git pull
 git pull
 ```
 ```
 
 
-This will pull any upstream changes to your local FPC repository.
 
 
 Switching to the fixes branch:
 Switching to the fixes branch:
 ```sh
 ```sh
@@ -68,17 +68,15 @@ cd compiler
 git checkout pas2js/fixes_3_0
 git checkout pas2js/fixes_3_0
 ```
 ```
 
 
-
 #### Building on Linux/macOS
 #### Building on Linux/macOS
 type the following command:
 type the following command:
 ```sh
 ```sh
-make all
+make clean all
 ```
 ```
 
 
 This creates with a 64-bit fpc the executable `bin/x86_64-linux/pas2js`
 This creates with a 64-bit fpc the executable `bin/x86_64-linux/pas2js`
 and a basic config file `bin/x86_64-linux/pas2js.cfg`.
 and a basic config file `bin/x86_64-linux/pas2js.cfg`.
 
 
-
 #### Building on Windows
 #### Building on Windows
 
 
 
 
@@ -93,7 +91,7 @@ If you installed the 64-bit version of fpc in `C:\YourPathOfFPC\3.2.2` use
 set PATH=C:\YourPathOfFPC\3.2.2\bin\x86-64-win64;%PATH%
 set PATH=C:\YourPathOfFPC\3.2.2\bin\x86-64-win64;%PATH%
 ```
 ```
 Then compile
 Then compile
-make all
+make clean all
 
 
 If you see "Error makefile ... Command syntax error" your "set PATH" was
 If you see "Error makefile ... Command syntax error" your "set PATH" was
 not correct.
 not correct.

+ 11 - 1
fpmake.pp

@@ -179,7 +179,7 @@ Var
   P : TPackage;
   P : TPackage;
   UnitDir,DemoDir,BD, TmpCfg, TmpCfg2: String;
   UnitDir,DemoDir,BD, TmpCfg, TmpCfg2: String;
   T: TTarget;
   T: TTarget;
-  FPCSrcDir: String;
+  FPCSrcDir, Pas2jsOFilename: String;
 
 
 begin
 begin
   FPCSrcDir:=GetEnvironmentVariable('FPCDIR');
   FPCSrcDir:=GetEnvironmentVariable('FPCDIR');
@@ -337,7 +337,17 @@ begin
       AddDemoFiles(P.InstallFiles,'rtl',DemoDir);
       AddDemoFiles(P.InstallFiles,'rtl',DemoDir);
       end;
       end;
     rmClean:
     rmClean:
+      begin
       P.CleanFiles.Add(TmpCfg);
       P.CleanFiles.Add(TmpCfg);
+      // workaround for fpc bug 40602: delete pas2js.o in FPCDIR
+      Pas2jsOFilename:=FPCSrcDir+SetDirSeparators('utils/pas2js/units/'+Defaults.Target+'/pas2js.o');
+      if FileExists(Pas2jsOFilename) then
+        if not DeleteFile(Pas2jsOFilename) then
+          begin
+          writeln('Unable to delete "'+Pas2jsOFilename+'"');
+          Halt(3);
+          end;
+      end;
     rmDistClean:
     rmDistClean:
       if FileExists(BD+'pas2js.cfg') then
       if FileExists(BD+'pas2js.cfg') then
         P.CleanFiles.Add(BD+'pas2js.cfg');
         P.CleanFiles.Add(BD+'pas2js.cfg');