1#
2#   Makefile.fpc for running fpmake
3#
4
5[package]
6name=hermes
7version=3.2.2
8
9[require]
10packages=rtl fpmkunit
11
12[install]
13fpcpackage=y
14
15[default]
16fpcdir=../..
17
18[prerules]
19FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT))
20ifdef OS_TARGET
21FPC_TARGETOPT+=--os=$(OS_TARGET)
22endif
23ifdef CPU_TARGET
24FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
25endif
26LOCALFPMAKE=./fpmake$(SRCEXEEXT)
27
28[rules]
29# Do not pass the Makefile's unit and binary target locations. Fpmake uses it's own.
30override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
31override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
32# Do not pass the package-unitdirectories. Fpmake adds those and this way they don't apear in the .fpm
33override FPCOPT:=$(filter-out $(addprefix -Fu,$(COMPILER_UNITDIR)),$(FPCOPT))# Compose general fpmake-parameters
34# Compose general fpmake-parameters
35ifdef FPMAKEOPT
36FPMAKE_OPT+=$(FPMAKEOPT)
37endif
38FPMAKE_OPT+=--localunitdir=../..
39FPMAKE_OPT+=--globalunitdir=..
40FPMAKE_OPT+=$(FPC_TARGETOPT)
41FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
42FPMAKE_OPT+=--compiler=$(FPC)
43FPMAKE_OPT+=-bu
44.NOTPARALLEL:
45
46fpmake$(SRCEXEEXT): fpmake.pp
47	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
48all:	fpmake$(SRCEXEEXT)
49	$(LOCALFPMAKE) compile $(FPMAKE_OPT)
50smart:	fpmake$(SRCEXEEXT)
51	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
52release:	fpmake$(SRCEXEEXT)
53	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
54debug:	fpmake$(SRCEXEEXT)
55	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
56# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
57# most often fail because the dependencies are cleared.
58# In case of a clean, simply do nothing
59ifeq ($(FPMAKE_BIN_CLEAN),)
60clean:
61else
62clean:
63	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
64endif
65# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
66# when the package is compiled using fpcmake prior to running this clean using fpmake
67ifeq ($(FPMAKE_BIN_CLEAN),)
68distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
69else
70distclean:
71ifdef inUnix
72        { $(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;  }
73else
74        $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
75endif
76	-$(DEL) $(LOCALFPMAKE)
77endif
78cleanall: distclean
79install:	fpmake$(SRCEXEEXT)
80ifdef UNIXHier
81	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
82else
83	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
84endif
85# distinstall also installs the example-sources and omits the location of the source-
86# files from the fpunits.cfg files.
87distinstall:	fpmake$(SRCEXEEXT)
88ifdef UNIXHier
89	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
90else
91	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
92endif
93zipinstall:	fpmake$(SRCEXEEXT)
94	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
95zipdistinstall:	fpmake$(SRCEXEEXT)
96	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
97zipsourceinstall:	fpmake$(SRCEXEEXT)
98ifdef UNIXHier
99	$(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
100else
101	$(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
102endif
103