Makefile.fpc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #
  2. # Makefile.fpc for running fpmake
  3. #
  4. [package]
  5. name=fpcm
  6. version=2.7.1
  7. [require]
  8. packages=rtl fpmkunit
  9. [install]
  10. fpcpackage=y
  11. [default]
  12. fpcdir=../..
  13. [prerules]
  14. FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)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=.$(PATHSEP)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. # Compose general fpmake-parameters
  28. ifdef FPMAKEOPT
  29. FPMAKE_OPT+=$(FPMAKEOPT)
  30. endif
  31. FPMAKE_OPT+=--localunitdir=../..
  32. FPMAKE_OPT+=--globalunitdir=../../packages
  33. FPMAKE_OPT+=$(FPC_TARGETOPT)
  34. FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
  35. FPMAKE_OPT+=--compiler=$(FPC)
  36. FPMAKE_OPT+=-bu
  37. .NOTPARALLEL:
  38. fpmake: fpmake.pp
  39. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  40. all: fpmake
  41. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  42. smart: fpmake
  43. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  44. release: fpmake
  45. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  46. debug: fpmake
  47. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  48. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  49. # most often fail because the dependencies are cleared.
  50. # In case of a clean, simply do nothing
  51. ifeq ($(FPMAKE_BIN_CLEAN),)
  52. clean:
  53. else
  54. clean:
  55. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  56. endif
  57. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  58. # when the package is compiled using fpcmake prior to running this clean using fpmake
  59. ifeq ($(FPMAKE_BIN_CLEAN),)
  60. distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
  61. else
  62. distclean:
  63. ifdef inUnix
  64. { $(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; }
  65. else
  66. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  67. endif
  68. -$(DEL) $(LOCALFPMAKE)
  69. endif
  70. cleanall: distclean
  71. install: fpmake
  72. ifdef UNIXHier
  73. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
  74. else
  75. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
  76. endif
  77. # distinstall also installs the example-sources
  78. distinstall: fpmake
  79. ifdef UNIXHier
  80. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie
  81. else
  82. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie
  83. endif
  84. zipinstall: fpmake
  85. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  86. zipdistinstall: fpmake
  87. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie
  88. # Cygwin doesn't like c:/path/
  89. ifndef inCygWin
  90. $(BS_UNITDIR):
  91. $(MKDIRTREE) $(BS_UNITDIR)
  92. bootstrap: $(BS_UNITDIR) fpcmake.inc
  93. $(FPCFPMAKE) fpcmake.pp $(FPMAKE_SKIP_CONFIG) -Fu$(UNITDIR_FPMAKE_RTL) -FU$(BS_UNITDIR) $(OPT)
  94. endif