Browse Source

+ Added section [defines] for defining misc things
+ Added OS lists BSDs and UNIXs under [defines]
+ Added phony target FORCE under [defines]
* More robust Darwin detection
* UNIXINSTALLDIR renamed to UNIXHier

olle 21 years ago
parent
commit
17f4f0d27f
2 changed files with 238 additions and 261 deletions
  1. 191 202
      utils/fpcm/fpcmake.inc
  2. 47 59
      utils/fpcm/fpcmake.ini

File diff suppressed because it is too large
+ 191 - 202
utils/fpcm/fpcmake.inc


+ 47 - 59
utils/fpcm/fpcmake.ini

@@ -2,6 +2,22 @@
 ; Templates used by fpcmake to create a Makefile from Makefile.fpc
 ;
 
+[defines]
+#####################################################################
+# Misc defines to be used by anyone
+#####################################################################
+
+# OS categories
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) sunos qnx
+
+#Empty target for rules that always should run. Needed if
+#the target is non-phoney, and there is non-phony prereqisites.
+#Then add FORCE as an prerequisite
+#See gnu make manual: 4.7 Rules without Commands or Prerequisites
+FORCE:
+.PHONY: FORCE
+
 [osdetect]
 #####################################################################
 # Autodetect source OS (Linux or Dos or Windows NT or OS/2 or other)
@@ -15,14 +31,22 @@
 # We need only / in the path also remove the current dir
 override PATH:=$(subst \,/,$(PATH))
 
-# Determine if we've a unix searchpath using : by looking for a ;
-# that normally doesn't exists in path names.
+# Detect unix
+# Darwin is handled specially
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+# Determine if we've a unix searchpath by looking for a ;
+# that normally doesn't exists in the unix PATH var.
 ifeq ($(findstring ;,$(PATH)),)
 inUnix=1
 SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
 else
 SEARCHPATH:=$(subst ;, ,$(PATH))
 endif
+endif
+
 # Add path were make is located
 SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
 
@@ -167,9 +191,6 @@ unexport CHECKDEPEND ALLDEPENDENCIES
 # FPC Target Detection
 #####################################################################
 
-# Some defines
-BSDTARGETS=freebsd netbsd openbsd darwin
-
 # Fall back to default values if needed
 ifndef CPU_TARGET
 ifdef CPU_TARGET_DEFAULT
@@ -223,7 +244,7 @@ endif
 
 
 # Detect BSD, since BSD uses a slightly different directory hierarchy.
-ifneq ($(findstring $(OS_TARGET),$(BSDTARGETS)),)
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
 BSDhier=1
 endif
 
@@ -388,55 +409,18 @@ override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
 endif
 
 
-# Linux, netbsd and freebsd use unix dirs with /usr/bin, /usr/lib
-# When zipping use the target as default, when normal install then
+# Unixes use unix dirs with /usr/bin, /usr/lib
+# When zipping use the target os default, when normal install then
 # use the source os as default
 ifdef ZIPINSTALL
 # Zipinstall
-ifeq ($(OS_TARGET),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),freebsd)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),netbsd)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),openbsd)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),darwin)
-UNIXINSTALLDIR=1
-endif
-
-ifeq ($(OS_TARGET),sunos)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),qnx)
-UNIXINSTALLDIR=1
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
 endif
 else
 # Normal install
-ifeq ($(OS_SOURCE),linux)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),freebsd)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),netbsd)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),openbsd)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_SOURCE),darwin)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),sunos)
-UNIXINSTALLDIR=1
-endif
-ifeq ($(OS_TARGET),qnx)
-UNIXINSTALLDIR=1
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
 endif
 endif
 
@@ -449,7 +433,7 @@ endif
 
 # set the prefix directory where to install everything
 ifndef INSTALL_PREFIX
-ifdef UNIXINSTALLDIR
+ifdef UNIXHier
 INSTALL_PREFIX=/usr/local
 else
 ifdef INSTALL_FPCPACKAGE
@@ -480,7 +464,7 @@ export DIST_DESTDIR
 
 # set the base directory where to install everything
 ifndef INSTALL_BASEDIR
-ifdef UNIXINSTALLDIR
+ifdef UNIXHier
 ifdef INSTALL_FPCPACKAGE
 INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
 else
@@ -493,7 +477,7 @@ endif
 
 # set the directory where to install the binaries
 ifndef INSTALL_BINDIR
-ifdef UNIXINSTALLDIR
+ifdef UNIXHier
 ifdef CROSSCOMPILE
 INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin
 else
@@ -529,7 +513,7 @@ endif
 
 # Where to install shared libraries
 ifndef INSTALL_LIBDIR
-ifdef UNIXINSTALLDIR
+ifdef UNIXHier
 INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
 else
 INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
@@ -538,7 +522,7 @@ endif
 
 # Where the source files will be stored
 ifndef INSTALL_SOURCEDIR
-ifdef UNIXINSTALLDIR
+ifdef UNIXHier
 ifdef BSDhier
 SRCPREFIXDIR=share/src
 else
@@ -572,7 +556,7 @@ endif
 
 # Where the doc files will be stored
 ifndef INSTALL_DOCDIR
-ifdef UNIXINSTALLDIR
+ifdef UNIXHier
 ifdef BSDhier
 DOCPREFIXDIR=share/doc
 else
@@ -599,7 +583,7 @@ endif
 # Where to install the examples, under linux we use the doc dir
 # because the copytree command will create a subdir itself
 ifndef INSTALL_EXAMPLEDIR
-ifdef UNIXINSTALLDIR
+ifdef UNIXHier
 ifdef INSTALL_FPCPACKAGE
 
 ifdef BSDhier
@@ -1769,6 +1753,9 @@ endif
 
 ifdef CLEANPPUFILES
 override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) 
+endif
 override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
 override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
 endif
@@ -1791,11 +1778,9 @@ ifdef CLEAN_FILES
 endif
 ifdef LIB_NAME
         -$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
-endif
-ifdef DEBUGSYMEXT
-        -$(DEL) *$(DEBUGSYMEXT)
 endif
         -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+        -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
 		
 fpc_distclean: clean
 
@@ -1816,6 +1801,9 @@ endif
 ifdef AOUTEXT
         -$(DEL) *$(AOUTEXT)
 endif
+ifdef DEBUGSYMEXT
+        -$(DEL) *$(DEBUGSYMEXT)
+endif
 
 
 [baseinforules]

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