Browse Source

* fpcmade.<TARGET> added
* parameter support. So it can be using with "find -name 'Makefile.fpc'"

peter 26 years ago
parent
commit
2c5b28763b
3 changed files with 253 additions and 210 deletions
  1. 190 175
      utils/fpcmake.inc
  2. 13 12
      utils/fpcmake.ini
  3. 50 23
      utils/fpcmake.pp

File diff suppressed because it is too large
+ 190 - 175
utils/fpcmake.inc


+ 13 - 12
utils/fpcmake.ini

@@ -450,11 +450,6 @@ endif
 # Default Tools
 #####################################################################
 
-# file used to check if a package is compiled
-ifndef FPCMAKED
-FPCMAKED=fpcmaked
-endif
-
 # assembler, redefine it if cross compiling
 ifndef AS
 AS=as
@@ -653,6 +648,7 @@ SMARTEXT=.sl
 STATICLIBEXT=.a
 SHAREDLIBEXT=.so
 PACKAGESUFFIX=
+FPCMADE=fpcmade
 
 # Go32v1
 ifeq ($(OS_TARGET),go32v1)
@@ -663,16 +659,19 @@ SMARTEXT=.sl1
 STATICLIBEXT=.a1
 SHAREDLIBEXT=.so1
 PACKAGESUFFIX=v1
+FPCMADE=fpcmade.v1
 endif
 
 # Go32v2
 ifeq ($(OS_TARGET),go32v2)
 PACKAGESUFFIX=go32
+FPCMADE=fpcmade.dos
 endif
 
 # Linux
 ifeq ($(OS_TARGET),linux)
 PACKAGESUFFIX=linux
+FPCMADE=fpcmade.lnx
 endif
 
 # Win32
@@ -684,6 +683,7 @@ SMARTEXT=.slw
 STATICLIBEXT=.aw
 SHAREDLIBEXT=.dll
 PACKAGESUFFIX=win32
+FPCMADE=fpcmade.w32
 endif
 
 # OS/2
@@ -695,6 +695,7 @@ SMARTEXT=.so
 STATICLIBEXT=.ao2
 SHAREDLIBEXT=.dll
 PACKAGESUFFIX=os2
+FPCMADE=fpcmade.os2
 endif
 
 # library prefix
@@ -819,12 +820,12 @@ fpc_test: examples
 
 .PHONY: fpc_all fpc_debug
 
-$(FPCMAKED):
-        @$(ECHO) Compiled > $(FPCMAKED)
+$(FPCMADE):
+        @$(ECHO) Compiled > $(FPCMADE)
 
 fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
          $(addsuffix _component,$(COMPILECOMPONENTS)) \
-         $(ALLTARGET) $(FPCMAKED)
+         $(ALLTARGET) $(FPCMADE)
 
 fpc_debug:
         $(MAKE) all DEBUG=1
@@ -897,7 +898,7 @@ else
 INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
 endif
 else
-INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
+INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
 endif
 endif
 
@@ -1033,7 +1034,7 @@ ifdef CLEANPPUFILES
 ifdef PPUFILES
 CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
 else
-CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES))
+CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
 endif
 endif
 
@@ -1050,7 +1051,7 @@ endif
 ifdef EXTRACLEANFILES
         -$(DEL) $(EXTRACLEANFILES)
 endif
-        -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
+        -$(DEL) $(FPCMADE) $(PPAS) link.res $(REDIRFILE)
 
 fpc_cleanall: $(CLEANTARGET)
 ifdef CLEANEXEFILES
@@ -1058,7 +1059,7 @@ ifdef CLEANEXEFILES
 endif
         -$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
         -$(DELTREE) *$(SMARTEXT)
-        -$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
+        -$(DEL) $(FPCMADE) $(PPAS) link.res $(REDIRFILE)
 
 
 [dependrules]

+ 50 - 23
utils/fpcmake.pp

@@ -237,9 +237,8 @@ end;
                                Makefile.fpc reading
 *****************************************************************************}
 
-function ReadMakefilefpc:boolean;
+function ReadMakefilefpc(const fn:string):boolean;
 var
-  fn  : string;
   ini : TIniFile;
 
   procedure ReadTargetsString(var t:Ttargetsstring;const sec,name,def:string);
@@ -255,13 +254,6 @@ var
   sec : tsections;
 begin
   ReadMakefilefpc:=false;
-  if FileExists('Makefile.fpc') then
-   fn:='Makefile.fpc'
-  else
-   if FileExists('makefile.fpc') then
-    fn:='makefile.fpc'
-  else
-   exit;
 
   Verbose('Reading '+fn);
   ini:=TIniFile.Create(fn);
@@ -404,7 +396,7 @@ end;
                                Makefile writing
 *****************************************************************************}
 
-function WriteMakefile:boolean;
+function WriteMakefile(const fn:string):boolean;
 var
   mf : TStringList;
   ss : TStringList;
@@ -560,7 +552,7 @@ var
     if ifdefneed then
      mf.Add('ifdef PACKAGE'+Uppercase(s));
     mf.Add('ifneq ($(wildcard '+packagedir+s3+'),)');
-    mf.Add('ifeq ($(wildcard '+packagedir+s3+'/$(FPCMAKED)),)');
+    mf.Add('ifeq ($(wildcard '+packagedir+s3+'/$(FPCMADE)),)');
     mf.Add('override COMPILEPACKAGES+='+s2);
     mf.Add(s2+'_package:');
     mf.Add(#9'$(MAKE) -C '+packagedir+s3+' all');
@@ -575,7 +567,7 @@ var
   begin
     mf.Add('ifdef COMPONENT'+Uppercase(s));
     mf.Add('ifneq ($(wildcard $(COMPONENTDIR)/'+s+'),)');
-    mf.Add('ifeq ($(wildcard $(COMPONENTDIR)/'+s+'/$(FPCMAKED)),)');
+    mf.Add('ifeq ($(wildcard $(COMPONENTDIR)/'+s+'/$(FPCMADE)),)');
     mf.Add('override COMPILECOMPONENTS+='+s);
     mf.Add(s+'_component:');
     mf.Add(#9'$(MAKE) -C $(COMPONENTDIR)/'+s+' all');
@@ -617,7 +609,6 @@ var
   i : integer;
 begin
 { Open the Makefile }
-  Verbose('Creating Makefile');
   mf:=TStringList.Create;
 { Buffer for reading and writing the sections }
   ss:=TStringList.Create;
@@ -944,34 +935,70 @@ begin
    end;
 
 { Write the Makefile and cleanup }
-  Verbose('Writing Makefile');
+  Verbose('Writing '+fn);
   FixTab(mf);
-  mf.SaveToFile('Makefile');
+  mf.SaveToFile(fn);
   mf.Destroy;
   ss.Destroy;
   WriteMakefile:=true;
 end;
 
 
+procedure UseMakefilefpc;
+var
+  fn : string;
+begin
+  if FileExists('Makefile.fpc') then
+   fn:='Makefile.fpc'
+  else
+   fn:='makefile.fpc';
+{ Open Makefile.fpc }
+  if not ReadMakefilefpc(fn) then
+   Error('Can''t read '+fn);
+{ Write Makefile }
+  if not WriteMakefile('Makefile') then
+   Error('Can''t write Makefile');
+end;
+
+
+procedure UseParameters;
+var
+  i  : integer;
+  fn : string;
+begin
+  for i:=1 to ParamCount do
+   begin
+     fn:=ParamStr(i);
+     { Open Makefile.fpc }
+     if not ReadMakefilefpc(fn) then
+      Error('Can''t read '+fn);
+     { Write Makefile }
+     if not WriteMakefile(ExtractFilePath(fn)+'Makefile') then
+      Error('Can''t write '+ExtractFilePath(fn)+'Makefile');
+   end;
+end;
+
+
 begin
 { Open userini.ini }
   fpcini:=ReadFpcMakeIni;
   if not assigned(fpcini) then
    Error('Can''t read fpcmake.ini');
 
-{ Open Makefile.fpc }
-  if not ReadMakefilefpc then
-   Error('Can''t read Makefile.fpc');
-
-{ Write Makefile }
-  if not WriteMakefile then
-   Error('Can''t write Makefile');
+  if ParamCount=0 then
+   UseMakefilefpc
+  else
+   UseParameters;
 
   fpcini.destroy;
 end.
 {
   $Log$
-  Revision 1.11  1999-12-02 11:30:24  peter
+  Revision 1.12  1999-12-19 15:15:04  peter
+    * fpcmade.<TARGET> added
+    * parameter support. So it can be using with "find -name 'Makefile.fpc'"
+
+  Revision 1.11  1999/12/02 11:30:24  peter
     * better dup checking
 
   Revision 1.10  1999/11/26 00:20:15  peter

Some files were not shown because too many files changed in this diff