Makefile.fpc 4.1 KB

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