瀏覽代碼

* prefix and extension handling fixed

git-svn-id: trunk@2258 -
florian 19 年之前
父節點
當前提交
270c8def11
共有 2 個文件被更改,包括 69 次插入8 次删除
  1. 46 3
      compiler/utils/Makefile
  2. 23 5
      compiler/utils/ppumove.pp

+ 46 - 3
compiler/utils/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/10]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/01/11]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
@@ -675,6 +675,8 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_SOURCEDIR+=..
 endif
+override SHARED_BUILD=n
+override SHARED_BUILD=n
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 endif
@@ -858,6 +860,9 @@ endif
 ifndef INSTALL_DATADIR
 INSTALL_DATADIR=$(INSTALL_BASEDIR)
 endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
 ifdef CROSSCOMPILE
 ifndef CROSSBINDIR
 CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
@@ -878,6 +883,7 @@ ASMEXT=.s
 SMARTEXT=.sl
 STATICLIBEXT=.a
 SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
 STATICLIBPREFIX=libp
 RSTEXT=.rst
 ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
@@ -1648,6 +1654,14 @@ ifeq ($(FPC_VERSION),1.0.6)
 override FPCOPTDEF+=HASUNIX
 endif
 endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-Aas
+endif
+endif
+ifdef LINKSHARED
+endif
 ifdef OPT
 override FPCOPT+=$(OPT)
 endif
@@ -1699,7 +1713,7 @@ ifdef TARGET_RSTS
 override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
 override CLEANRSTFILES+=$(RSTFILES)
 endif
-.PHONY: fpc_all fpc_smart fpc_debug fpc_release
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
 $(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
 	@$(ECHOREDIR) Compiled > $(FPCMADE)
 fpc_all: $(FPCMADE)
@@ -1740,6 +1754,35 @@ vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
 vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
 vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
 vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS)
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
 .PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
 ifdef INSTALL_UNITS
 override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
@@ -1998,7 +2041,7 @@ smart: fpc_smart
 release: fpc_release
 units: fpc_units
 examples:
-shared:
+shared: fpc_shared
 install: fpc_install
 sourceinstall: fpc_sourceinstall
 exampleinstall: fpc_exampleinstall

+ 23 - 5
compiler/utils/ppumove.pp

@@ -28,6 +28,7 @@ uses
 {$else unix}
   dos,
 {$endif unix}
+  sysutils,
   ppu,
   getopts;
 
@@ -65,6 +66,7 @@ Type
 
 Var
   ArBin,LDBin,StripBin,
+  OutputFileForPPU,
   OutputFile,
   OutputFileForLink,  { the name of the output file needed when linking }
   InputPath,
@@ -237,6 +239,7 @@ Var
   untilb : byte;
   l,m    : longint;
   f      : file;
+  ext,
   s      : string;
 begin
   DoPPU:=false;
@@ -355,13 +358,13 @@ begin
 { just add a new entry with the new lib }
   if MakeStatic then
    begin
-     outppu.putstring(outputfileforlink);
+     outppu.putstring(OutputfileForPPU);
      outppu.putlongint(link_static);
      outppu.writeentry(iblinkunitstaticlibs)
    end
   else
    begin
-     outppu.putstring(outputfileforlink);
+     outppu.putstring(OutputfileForPPU);
      outppu.putlongint(link_shared);
      outppu.writeentry(iblinkunitsharedlibs);
    end;
@@ -377,8 +380,22 @@ begin
              begin
                s:=inppu.getstring;
                m:=inppu.getlongint;
-               libs:=libs+' -l'+s;
+
                outppu.putstring(s);
+
+               { strip lib prefix }
+               if copy(s,1,3)='lib' then
+                 delete(s,1,3);
+
+               { strip lib prefix }
+               if copy(s,1,3)='lib' then
+                 delete(s,1,3);
+               ext:=ExtractFileExt(s);
+               if ext<>'' then
+                 delete(s,length(s)-length(ext)+1,length(ext));
+
+               libs:=libs+' -l'+s;
+
                outppu.putlongint(m);
              end;
          end
@@ -488,7 +505,7 @@ begin
   if DestPath<>'' then
    begin
      Assign(F, OutputFile);
-     Rename(F,DestPath+'/'+OutputFile);
+     Rename(F,DestPath+DirectorySeparator+OutputFile);
    end;
 end;
 
@@ -585,7 +602,8 @@ begin
   else
    LibExt:=SharedLibExt;
   if OutputFile='' then
-   OutPutFile:=Paramstr(OptInd);
+   OutputFile:=Paramstr(OptInd);
+  OutputFileForPPU:=OutputFile;
 { fix filename }
 {$ifdef unix}
   if Copy(OutputFile,1,3)<>'lib' then