Makefile.fpc 4.1 KB

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