Makefile.fpc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #
  2. # Makefile.fpc for running fpmake
  3. #
  4. [require]
  5. packages=rtl fpmkunit fcl-json
  6. [install]
  7. fpcpackage=y
  8. fpcsubdir=utils
  9. [default]
  10. fpcdir=..
  11. [prerules]
  12. # Translate INSTALL_UNITDIR to fpmake's --unitinstalldir parameter
  13. ifdef INSTALL_UNITDIR
  14. FPMAKE_INSTALL_OPT+=--unitinstalldir=$(INSTALL_UNITDIR)
  15. endif
  16. ifdef INSTALL_BINDIR
  17. FPMAKE_INSTALL_OPT+=--bininstalldir=$(INSTALL_BINDIR)
  18. endif
  19. ifdef INSTALL_LIBDIR
  20. FPMAKE_INSTALL_OPT+=--libinstalldir=$(INSTALL_LIBDIR)
  21. endif
  22. # Translate OS_TARGET and CPU_TARGET to fpmake's --os and --cpu parameters
  23. ifdef OS_TARGET
  24. FPC_TARGETOPT+=--os=$(OS_TARGET)
  25. endif
  26. ifdef CPU_TARGET
  27. FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
  28. endif
  29. FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT))
  30. LOCALFPMAKE=./fpmake$(SRCEXEEXT)
  31. SUB_FPMAKE_SRCS=$(wildcard */fpmake.pp)
  32. [rules]
  33. # Do not pass the Makefile's unit and binary target locations. Fpmake uses it's own.
  34. override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
  35. override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
  36. # Do not pass the package-unitdirectories. Fpmake adds those and this way they don't apear in the .fpm
  37. override FPCOPT:=$(filter-out $(addprefix -Fu,$(COMPILER_UNITDIR)),$(FPCOPT))# Compose general fpmake-parameters
  38. # Compose general fpmake-parameters
  39. ifdef FPMAKEOPT
  40. FPMAKE_OPT+=$(FPMAKEOPT)
  41. endif
  42. FPMAKE_OPT+=--localunitdir=..
  43. FPMAKE_OPT+=--globalunitdir=../packages
  44. FPMAKE_OPT+=$(FPC_TARGETOPT)
  45. FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
  46. FPMAKE_OPT+=--compiler=$(FPC)
  47. FPMAKE_OPT+=-bu
  48. ifndef BUILDFULLNATIVE
  49. FPMAKE_OPT+=-scp
  50. endif
  51. .NOTPARALLEL:
  52. fpmake$(SRCEXEEXT): fpmake.pp $(SUB_FPMAKE_SRCS) fpmake_add.inc fpmake_proc.inc
  53. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  54. all: fpmake$(SRCEXEEXT)
  55. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  56. smart: fpmake$(SRCEXEEXT)
  57. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  58. release: fpmake$(SRCEXEEXT)
  59. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  60. debug: fpmake$(SRCEXEEXT)
  61. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  62. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  63. # most often fail because the dependencies are cleared.
  64. # In case of a clean, simply do nothing
  65. ifeq ($(FPMAKE_BIN_CLEAN),)
  66. clean:
  67. else
  68. clean:
  69. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  70. endif
  71. CLEAN_TARGET_DIRS=$(subst /Makefile.fpc, ,$(wildcard */Makefile.fpc))
  72. %_distclean:
  73. $(MAKE) -C $* distclean
  74. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  75. # when the package is compiled using fpcmake prior to running this clean using fpmake
  76. ifeq ($(FPMAKE_BIN_CLEAN),)
  77. distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS))
  78. else
  79. distclean:
  80. ifdef inUnix
  81. { $(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; }
  82. else
  83. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  84. endif
  85. -$(DEL) $(LOCALFPMAKE)
  86. -$(DEL) fpmake.o
  87. -$(DEL) fpmake.dbg
  88. endif
  89. cleanall: distclean
  90. install: fpmake$(SRCEXEEXT)
  91. ifdef UNIXHier
  92. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
  93. else
  94. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
  95. endif
  96. # distinstall also installs the example-sources and omits the location of the source-
  97. # files from the fpunits.cfg files.
  98. distinstall: fpmake$(SRCEXEEXT)
  99. ifdef UNIXHier
  100. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  101. else
  102. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  103. endif
  104. zipinstall: fpmake$(SRCEXEEXT)
  105. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  106. zipdistinstall: fpmake$(SRCEXEEXT)
  107. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
  108. zipsourceinstall: fpmake$(SRCEXEEXT)
  109. ifdef UNIXHier
  110. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
  111. else
  112. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
  113. endif
  114. #####################################################################
  115. # PPU testing targets
  116. #####################################################################
  117. PPULIST:=$(wildcard */units/*/*.ppu) $(wildcard units/*/*.ppu)
  118. PPULOGLIST:=$(subst .ppu,.log-ppu,$(PPULIST))
  119. RMPPULOGLIST:=$(subst .ppu,.rm-log-ppu,$(PPULIST))
  120. .PHONY : ppulogs cleanppulogs testppudump $(RMPPULOGLIST)
  121. ppulogs : $(PPULOGLIST)
  122. vpath %.ppu $(ALLPPUDIRS)
  123. vpath %.log-ppu $(ALLPPUDIRS)
  124. vpath %.rm-log-ppu $(ALLPPUDIRS)
  125. # Do not try to recompile ppudump, as this does not work if trying to test cross-compiled units
  126. %.log-ppu : %.ppu
  127. ppudump -VA -M $< > $@
  128. %.rm-log-ppu : %.ppu ../compiler/utils/ppudump$(EXEEXT)
  129. -$(RMPROG) $<
  130. ../compiler/utils/ppudump$(EXEEXT):
  131. $(MAKE) -C $(COMPILERDIR)/utils ppudump$(EXEEXT)
  132. ppuinfo :
  133. echo PPU list is "$(PPULIST)"
  134. echo PPULOG list is "$(PPULOGLIST)"
  135. cleanppulogs : $(RMPPULOGLIST)
  136. testppudump :
  137. $(MAKE) cleanppulogs ppulogs