* Template file for testing fpmake-building

git-svn-id: trunk@20185 -
This commit is contained in:
joost 2012-01-28 11:00:33 +00:00
parent 60ff11d19e
commit ff81a5018f
2 changed files with 101 additions and 0 deletions

1
.gitattributes vendored
View File

@ -784,6 +784,7 @@ installer/winshell.pas svneol=native#text/plain
installer/writeidx.pas svneol=native#text/plain
packages/Makefile svneol=native#text/plain
packages/Makefile.fpc svneol=native#text/plain
packages/Makefile.fpc.fpmake svneol=native#text/plain
packages/a52/Makefile svneol=native#text/plain
packages/a52/Makefile.fpc svneol=native#text/plain
packages/a52/Makefile.fpc.fpcmake svneol=native#text/plain

View File

@ -0,0 +1,100 @@
#
# Makefile.fpc for Free Pascal Packages
#
[require]
packages=rtl
[install]
fpcpackage=y
fpcsubdir=packages
[default]
fpcdir=..
[prerules]
# Translate INSTALL_UNITDIR to fpmake's --unitinstalldir parameter
ifdef INSTALL_UNITDIR
FPMAKE_INSTALL_OPT+=--unitinstalldir=$(INSTALL_UNITDIR)
endif
# Translate OS_TARGET and CPU_TARGET to fpmake's --os and --cpu parameters
ifdef OS_TARGET
FPC_TARGETOPT+=--os=$(OS_TARGET)
endif
ifdef CPU_TARGET
FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
endif
FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)fpmake$(SRCEXEEXT))
LOCALFPMAKE=.$(PATHSEP)fpmake$(SRCEXEEXT)
# Get the location of the bootstrap-fpmkunit units
PACKAGEDIR_FPMKUNIT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Makefile.fpc,$(PACKAGESDIR))))))
ifneq ($(PACKAGEDIR_FPMKUNIT),)
UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)
else
PACKAGEDIR_FPMKUNIT=
UNITDIR_FPMKUNIT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Package.fpc,$(UNITSDIR)))))
ifneq ($(UNITDIR_FPMKUNIT),)
UNITDIR_FPMKUNIT:=$(firstword $(UNITDIR_FPMKUNIT))
else
UNITDIR_FPMKUNIT=
endif
endif
ifdef UNITDIR_FPMAKE_FPMKUNIT
override COMPILER_FPMAKE_UNITDIR=$(UNITDIR_FPMAKE_FPMKUNIT)
endif
[rules]
# Do not pass the Makefile's unit and binary target locations. fpmake uses it's own.
override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
.NOTPARALLEL:
fpmkunit_bootstrap:
$(MAKE) -C fpmkunit bootstrap
fpmake: fpmake.pp fpmkunit_bootstrap
$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT)
all: fpmake
$(LOCALFPMAKE) compile --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu
smart: fpmake
$(LOCALFPMAKE) compile --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -XX -o -CX
release: fpmake
$(LOCALFPMAKE) compile --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -dRELEASE
debug: fpmake
$(LOCALFPMAKE) compile --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -dDEBUG
# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
# most often fail because the dependencies are cleared.
# In case of a clean, simply do nothing
ifeq ($(FPMAKE_BIN_CLEAN),)
clean:
else
clean:
$(FPMAKE_BIN_CLEAN) clean --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
endif
# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
# when the package is compiled using fpcmake prior to running this clean using fpmake
# It does not work well, though, since the sub-directories are not cleaned at all.
ifeq ($(FPMAKE_BIN_CLEAN),)
distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
else
distclean:
ifdef inUnix
{ $(FPMAKE_BIN_CLEAN) distclean --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi; }
else
$(FPMAKE_BIN_CLEAN) distclean --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
endif
-$(DEL) $(LOCALFPMAKE)
endif
install: fpmake
ifdef UNIXHier
$(LOCALFPMAKE) install --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
else
$(LOCALFPMAKE) install --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
endif
# distinstall also installs the example-sources
distinstall: fpmake
ifdef UNIXHier
$(LOCALFPMAKE) install --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie
else
$(LOCALFPMAKE) install --localunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie
endif