# # Makefile.fpc for running fpmake # [require] packages=rtl fpmkunit [install] fpcpackage=y fpcsubdir=ide [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 ./fpmake$(SRCEXEEXT)) LOCALFPMAKE=./fpmake$(SRCEXEEXT) # do not add -d$(CPU_TARGET) override NOCPUDEF=1 [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)) # Compose general fpmake-parameters ifdef FPMAKEOPT FPMAKE_OPT+=$(FPMAKEOPT) endif FPMAKE_OPT+=--localunitdir=.. FPMAKE_OPT+=--globalunitdir=../packages FPMAKE_OPT+=$(FPC_TARGETOPT) FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT)) FPMAKE_OPT+=--compiler=$(FPC) FPMAKE_OPT+=-bu ifndef BUILDFULLNATIVE FPMAKE_OPT+=-sp endif ifdef NOGDB FPMAKE_OPT+=--NoGDB=1 endif ifdef GDBMI FPMAKE_OPT+=--GDBMI=1 endif ifdef PPC_TARGET FPMAKE_OPT+=--CompilerTarget=$(PPC_TARGET) endif .NOTPARALLEL: fpmake$(SRCEXEEXT): fpmake.pp $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT) all: fpmake$(SRCEXEEXT) $(LOCALFPMAKE) compile $(FPMAKE_OPT) smart: fpmake$(SRCEXEEXT) $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX release: fpmake$(SRCEXEEXT) $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE debug: fpmake$(SRCEXEEXT) $(LOCALFPMAKE) compile $(FPMAKE_OPT) -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 $(FPMAKE_OPT) endif CLEAN_TARGET_DIRS=$(subst /Makefile.fpc, ,$(wildcard */Makefile.fpc)) %_distclean: $(MAKE) -C $* distclean # 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 ifeq ($(FPMAKE_BIN_CLEAN),) distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS)) else distclean: ifdef inUnix { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); 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 $(FPMAKE_OPT) endif -$(DEL) $(LOCALFPMAKE) -$(DEL) fpmake.o -$(DEL) fpmake.dbg endif cleanall: distclean install: fpmake$(SRCEXEEXT) ifdef UNIXHier $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) else $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) endif # distinstall also installs the example-sources and omits the location of the source- # files from the fpunits.cfg files. distinstall: fpmake$(SRCEXEEXT) ifdef UNIXHier $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie -fsp 0 else $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie -fsp 0 endif zipinstall: fpmake$(SRCEXEEXT) $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) zipdistinstall: fpmake$(SRCEXEEXT) $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0 zipsourceinstall: fpmake$(SRCEXEEXT) ifdef UNIXHier $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\) else $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\) endif