Makefile.fpc 4.8 KB

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