Makefile.fpc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #
  2. # Makefile.fpc for running fpmake
  3. #
  4. [package]
  5. name=libtar
  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. .NOTPARALLEL:
  65. fpmake$(SRCEXEEXT): fpmake.pp
  66. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  67. all: fpmake$(SRCEXEEXT)
  68. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  69. smart: fpmake$(SRCEXEEXT)
  70. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  71. release: fpmake$(SRCEXEEXT)
  72. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  73. debug: fpmake$(SRCEXEEXT)
  74. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  75. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  76. # most often fail because the dependencies are cleared.
  77. # In case of a clean, simply do nothing
  78. ifeq ($(FPMAKE_BIN_CLEAN),)
  79. clean:
  80. else
  81. clean:
  82. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  83. endif
  84. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  85. # when the package is compiled using fpcmake prior to running this clean using fpmake
  86. ifeq ($(FPMAKE_BIN_CLEAN),)
  87. distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
  88. else
  89. distclean:
  90. ifdef inUnix
  91. { $(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; }
  92. else
  93. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  94. endif
  95. -$(DEL) $(LOCALFPMAKE)
  96. endif
  97. cleanall: distclean
  98. install: fpmake$(SRCEXEEXT)
  99. ifdef UNIXHier
  100. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
  101. else
  102. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
  103. endif
  104. # distinstall also installs the example-sources and omits the location of the source-
  105. # files from the fpunits.cfg files.
  106. distinstall: fpmake$(SRCEXEEXT)
  107. ifdef UNIXHier
  108. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
  109. else
  110. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie -fsp 0
  111. endif
  112. zipinstall: fpmake$(SRCEXEEXT)
  113. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  114. zipdistinstall: fpmake$(SRCEXEEXT)
  115. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
  116. zipsourceinstall: fpmake$(SRCEXEEXT)
  117. ifdef UNIXHier
  118. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
  119. else
  120. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
  121. endif