Browse Source

* exeext is target dependent
* UNIXINSTALLDIR variable used for linux,freebsd targets (merged)

peter 25 years ago
parent
commit
00f34abe87
2 changed files with 261 additions and 236 deletions
  1. 198 185
      utils/fpcmake.inc
  2. 63 51
      utils/fpcmake.ini

File diff suppressed because it is too large
+ 198 - 185
utils/fpcmake.inc


+ 63 - 51
utils/fpcmake.ini

@@ -5,7 +5,7 @@
 [osdetect]
 #####################################################################
 # Autodetect OS (Linux or Dos or Windows NT)
-# define inlinux when running under linux
+# define inUnix when running under Unix (Linux,FreeBSD)
 # define inWinNT when running under WinNT
 #####################################################################
 
@@ -22,22 +22,18 @@ nopwd:
         @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
         @exit
 else
-inlinux=1
+inUnix=1
 endif
 else
 PWD:=$(firstword $(PWD))
 endif
 
 # Detect NT - NT sets OS to Windows_NT
-ifndef inlinux
+# Detect OS/2 - OS/2 has OS2_SHELL defined
+ifndef inUnix
 ifeq ($(OS),Windows_NT)
 inWinNT=1
-endif
-endif
-
-# Detect OS/2 - OS/2 has OS2_SHELL defined
-ifndef inlinux
-ifndef inWinNT
+else
 ifdef OS2_SHELL
 inOS2=1
 endif
@@ -45,14 +41,14 @@ endif
 endif
 
 # The extension of executables
-ifdef inlinux
-EXEEXT=
+ifdef inUnix
+SRCEXEEXT=
 else
-EXEEXT=.exe
+SRCEXEEXT=.exe
 endif
 
 # The path which is searched separated by spaces
-ifdef inlinux
+ifdef inUnix
 SEARCHPATH=$(subst :, ,$(PATH))
 else
 SEARCHPATH=$(subst ;, ,$(PATH))
@@ -89,8 +85,8 @@ FPC=ppc386
 endif
 endif
 endif
-override FPC:=$(subst $(EXEEXT),,$(FPC))
-override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
 
 # Target OS
 ifndef OS_TARGET
@@ -140,7 +136,7 @@ endif
 [fpcdirdetect]
 # Detect FPCDIR
 ifeq ($(FPCDIR),wrong)
-ifdef inlinux
+ifdef inUnix
 override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
 ifeq ($(wildcard $(FPCDIR)/units),)
 override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
@@ -210,7 +206,7 @@ endif
 ifndef ECHO
 ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
 ifeq ($(ECHO),)
-ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(ECHO),)
 ECHO:=echo
 ECHOE:=echo
@@ -251,7 +247,7 @@ endif
 
 # To install files
 ifndef INSTALL
-ifdef inlinux
+ifdef inUnix
 INSTALL:=install -m 644
 else
 INSTALL:=$(COPY)
@@ -260,7 +256,7 @@ endif
 
 # To install programs
 ifndef INSTALLEXE
-ifdef inlinux
+ifdef inUnix
 INSTALLEXE:=install -m 755
 else
 INSTALLEXE:=$(COPY)
@@ -269,7 +265,7 @@ endif
 
 # To make a directory.
 ifndef MKDIR
-ifdef inlinux
+ifdef inUnix
 MKDIR:=install -m 755 -d
 else
 MKDIR:=ginstall -m 755 -d
@@ -295,7 +291,7 @@ LD=ld
 endif
 
 # ppas.bat / ppas.sh
-ifdef inlinux
+ifdef inUnix
 PPAS=ppas.sh
 else
 ifdef inOS2
@@ -306,7 +302,7 @@ endif
 endif
 
 # ldconfig to rebuild .so cache
-ifdef inlinux
+ifdef inUnix
 LDCONFIG=ldconfig
 else
 LDCONFIG=
@@ -315,7 +311,7 @@ endif
 [tool_ppdep]
 # ppdep
 ifndef PPDEP
-PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
+PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(PPDEP),)
 PPDEP=
 else
@@ -327,7 +323,7 @@ export PPDEP
 [tool_ppumove]
 # ppumove
 ifndef PPUMOVE
-PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(PPUMOVE),)
 PPUMOVE=
 else
@@ -339,7 +335,7 @@ export PPUMOVE
 [tool_ppufiles]
 # ppufiles
 ifndef PPUFILES
-PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(PPUFILES),)
 PPUFILES=
 else
@@ -351,7 +347,7 @@ export PPUFILES
 [tool_data2inc]
 # data2inc
 ifndef DATA2INC
-DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(EXEEXT),$(SEARCHPATH))))
+DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(DATA2INC),)
 DATA2INC=
 else
@@ -363,7 +359,7 @@ export DATA2INC
 [tool_diff]
 # diff
 ifndef DIFF
-DIFF:=$(strip $(wildcard $(addsuffix /diff$(EXEEXT),$(SEARCHPATH))))
+DIFF:=$(strip $(wildcard $(addsuffix /diff$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(DIFF),)
 DIFF=
 else
@@ -375,7 +371,7 @@ export DIFF
 [tool_cmp]
 # cmp
 ifndef CMP
-CMP:=$(strip $(wildcard $(addsuffix /cmp$(EXEEXT),$(SEARCHPATH))))
+CMP:=$(strip $(wildcard $(addsuffix /cmp$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(CMP),)
 CMP=
 else
@@ -387,7 +383,7 @@ export CMP
 [tool_sed]
 # Sed
 ifndef SED
-SED:=$(strip $(wildcard $(addsuffix /sed$(EXEEXT),$(SEARCHPATH))))
+SED:=$(strip $(wildcard $(addsuffix /sed$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(SED),)
 SED=
 else
@@ -407,7 +403,7 @@ ifeq ($(OS_TARGET),win32)
 UPXPROG:=1
 endif
 ifdef UPXPROG
-UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(UPXPROG),)
 UPXPROG=
 else
@@ -422,9 +418,9 @@ export UPXPROG
 [tool_date]
 # gdate/date
 ifndef DATE
-DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(DATE),)
-DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEACHPATH))))
 ifeq ($(DATE),)
 DATE=
 else
@@ -445,7 +441,7 @@ endif
 [tool_zip]
 # ZipProg, you can't use Zip as the var name (PFV)
 ifndef ZIPPROG
-ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(ZIPPROG),)
 ZIPPROG=
 else
@@ -460,7 +456,7 @@ ZIPEXT=.zip
 [tool_tar]
 # Tar
 ifndef TARPROG
-TARPROG:=$(strip $(wildcard $(addsuffix /tar$(EXEEXT),$(SEARCHPATH))))
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
 ifeq ($(TARPROG),)
 TARPROG=
 else
@@ -485,6 +481,7 @@ endif
 
 # Default needed extensions (Go32v2,Linux)
 LOADEREXT=.as
+EXEEXT=.exe
 PPLEXT=.ppl
 PPUEXT=.ppu
 OEXT=.o
@@ -513,9 +510,18 @@ endif
 
 # Linux
 ifeq ($(OS_TARGET),linux)
+EXEEXT=
+HASSHAREDLIB=1
 FPCMADE=fpcmade.lnx
 endif
 
+# Linux
+ifeq ($(OS_TARGET),freebsd)
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.freebsd
+endif
+
 # Win32
 ifeq ($(OS_TARGET),win32)
 PPUEXT=.ppw
@@ -567,9 +573,17 @@ endif
 # Default Directories
 #####################################################################
 
+# Linux and freebsd use unix dirs with /usr/bin, /usr/lib
+ifeq ($(OS_TARGET),linux)
+UNIXINSTALLDIR=1
+endif
+ifeq ($(OS_TARGET),freebsd)
+UNIXINSTALLDIR=1
+endif
+
 # set the prefix directory where to install everything
 ifndef PREFIXINSTALLDIR
-ifdef inlinux
+ifdef UNIXINSTALLDIR
 PREFIXINSTALLDIR=/usr
 else
 PREFIXINSTALLDIR=/pp
@@ -591,7 +605,7 @@ export DESTZIPDIR
 
 # set the base directory where to install everything
 ifndef BASEINSTALLDIR
-ifdef inlinux
+ifdef UNIXINSTALLDIR
 BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
 else
 BASEINSTALLDIR=$(PREFIXINSTALLDIR)
@@ -600,7 +614,7 @@ endif
 
 # set the directory where to install the binaries
 ifndef BININSTALLDIR
-ifdef inlinux
+ifdef UNIXINSTALLDIR
 BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
 else
 BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
@@ -617,7 +631,7 @@ endif
 
 # Where to install shared libraries
 ifndef LIBINSTALLDIR
-ifdef inlinux
+ifdef UNIXINSTALLDIR
 LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
 else
 LIBINSTALLDIR=$(UNITINSTALLDIR)
@@ -626,7 +640,7 @@ endif
 
 # Where the source files will be stored
 ifndef SOURCEINSTALLDIR
-ifdef inlinux
+ifdef UNIXINSTALLDIR
 SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
 else
 SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
@@ -638,7 +652,7 @@ endif
 
 # Where the doc files will be stored
 ifndef DOCINSTALLDIR
-ifdef inlinux
+ifdef UNIXINSTALLDIR
 DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
 else
 DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
@@ -648,7 +662,7 @@ endif
 # Where to install the examples, under linux we use the doc dir
 # because the copytree command will create a subdir itself
 ifndef EXAMPLEINSTALLDIR
-ifdef inlinux
+ifdef UNIXINSTALLDIR
 EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples
 else
 EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples
@@ -666,7 +680,7 @@ endif
 
 [dir_gcclib]
 # On linux, try to find where libgcc.a is.
-ifdef inlinux
+ifdef inUnix
 ifndef GCCLIBDIR
 GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`)
 endif
@@ -676,7 +690,7 @@ export GCCLIBDIR
 
 [dir_otherlib]
 # Where to find other libraries
-ifdef inlinux
+ifdef inUnix
 ifndef OTHERLIBDIR
 OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
 endif
@@ -694,7 +708,7 @@ REDIRFILE=log
 endif
 
 ifdef REDIR
-ifndef inlinux
+ifndef inUnix
 override FPC=redir -eo $(FPC)
 endif
 # set the verbosity to max
@@ -1071,7 +1085,7 @@ fpc_smart:
         $(MAKE) all LINKSMART=1 CREATESMART=1
 
 fpc_shared: all
-ifdef inlinux
+ifdef HASSHAREDLIB
 ifndef LIBNAME
         @$(ECHO) "LIBNAME not set"
 else
@@ -1118,7 +1132,7 @@ ifneq ($(INSTALLPPULINKFILES),)
 endif
 ifneq ($(wildcard $(LIBFULLNAME)),)
         @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)
-ifdef inlinux
+ifdef HASSHAREDLIB
         @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)
 endif
 endif
@@ -1146,7 +1160,7 @@ endif
 ifneq ($(wildcard $(LIBFULLNAME)),)
         $(MKDIR) $(LIBINSTALLDIR)
         $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)
-ifdef inlinux
+ifdef inUnix
         ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)
 endif
 endif
@@ -1212,7 +1226,7 @@ endif
 
 # Temporary path to pack a file
 ifndef PACKDIR
-ifndef inlinux
+ifndef inUnix
 PACKDIR=$(BASEDIR)/pack_tmp
 else
 PACKDIR=/tmp/fpc-pack
@@ -1228,7 +1242,7 @@ endif
 
 # Use tar by default under linux
 ifndef USEZIP
-ifdef inlinux
+ifdef inUnix
 USETAR=1
 endif
 endif
@@ -1359,7 +1373,6 @@ fpc_infocfg:
 
 [info_dirs]
 fpc_infodirs:
-ifdef inlinux
         @$(ECHO)
         @$(ECHO)  == Directory info ==
         @$(ECHO)
@@ -1374,7 +1387,6 @@ endif
         @$(ECHO)  GCC library..... $(GCCLIBDIR)
         @$(ECHO)  Other library... $(OTHERLIBDIR)
         @$(ECHO)
-endif
 
 [info_tools]
 fpc_infotools:

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