Makefile.fpc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. # Translate OS_TARGET and CPU_TARGET to fpmake's --os and --cpu parameters
  17. ifdef OS_TARGET
  18. FPC_TARGETOPT+=--os=$(OS_TARGET)
  19. endif
  20. ifdef CPU_TARGET
  21. FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
  22. endif
  23. FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT))
  24. LOCALFPMAKE=./fpmake$(SRCEXEEXT)
  25. [rules]
  26. # Do not pass the Makefile's unit and binary target locations. fpmake uses it's own.
  27. override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
  28. override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
  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. ifndef BUILDFULLNATIVE
  40. FPMAKE_OPT+=-sp
  41. endif
  42. .NOTPARALLEL:
  43. fpmake$(SRCEXEEXT): fpmake.pp
  44. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  45. all: fpmake$(SRCEXEEXT)
  46. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  47. smart: fpmake$(SRCEXEEXT)
  48. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  49. release: fpmake$(SRCEXEEXT)
  50. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  51. debug: fpmake$(SRCEXEEXT)
  52. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  53. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  54. # most often fail because the dependencies are cleared.
  55. # In case of a clean, simply do nothing
  56. ifeq ($(FPMAKE_BIN_CLEAN),)
  57. clean:
  58. else
  59. clean:
  60. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  61. endif
  62. CLEAN_TARGET_DIRS=$(subst /Makefile.fpc, ,$(wildcard */Makefile.fpc))
  63. %_distclean:
  64. $(MAKE) -C $* distclean
  65. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  66. # when the package is compiled using fpcmake prior to running this clean using fpmake
  67. ifeq ($(FPMAKE_BIN_CLEAN),)
  68. distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS))
  69. else
  70. distclean:
  71. ifdef inUnix
  72. { $(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; }
  73. else
  74. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  75. endif
  76. -$(DEL) $(LOCALFPMAKE)
  77. -$(DEL) fpmake.o
  78. -$(DEL) fpmake.dbg
  79. endif
  80. cleanall: distclean
  81. install: fpmake$(SRCEXEEXT)
  82. ifdef UNIXHier
  83. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
  84. else
  85. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
  86. endif
  87. # distinstall also installs the example-sources and omits the location of the source-
  88. # files from the fpunits.cfg files.
  89. distinstall: fpmake$(SRCEXEEXT)
  90. ifdef UNIXHier
  91. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  92. else
  93. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  94. endif
  95. zipinstall: fpmake$(SRCEXEEXT)
  96. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  97. zipdistinstall: fpmake$(SRCEXEEXT)
  98. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
  99. zipsourceinstall: fpmake$(SRCEXEEXT)
  100. ifdef UNIXHier
  101. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
  102. else
  103. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
  104. endif
  105. #####################################################################
  106. # PPU testing targets
  107. #####################################################################
  108. PPULIST:=$(wildcard */units/*/*.ppu) $(wildcard units/*/*.ppu)
  109. PPULOGLIST:=$(subst .ppu,.log-ppu,$(PPULIST))
  110. RMPPULOGLIST:=$(subst .ppu,.rm-log-ppu,$(PPULIST))
  111. .PHONY : ppulogs cleanppulogs testppudump $(RMPPULOGLIST)
  112. ppulogs : $(PPULOGLIST)
  113. vpath %.ppu $(ALLPPUDIRS)
  114. vpath %.log-ppu $(ALLPPUDIRS)
  115. vpath %.rm-log-ppu $(ALLPPUDIRS)
  116. %.log-ppu : %.ppu ../compiler/utils/ppudump$(EXEEXT)
  117. ..$(PATHSEP)compiler$(PATHSEP)utils$(PATHSEP)ppudump -VA -M $< > $@
  118. %.rm-log-ppu : %.ppu ../compiler/utils/ppudump$(EXEEXT)
  119. -$(RMPROG) $<
  120. ../compiler/utils/ppudump$(EXEEXT):
  121. $(MAKE) -C $(COMPILERDIR)/utils ppudump$(EXEEXT)
  122. ppuinfo :
  123. echo PPU list is "$(PPULIST)"
  124. echo PPULOG list is "$(PPULOGLIST)"
  125. cleanppulogs : $(RMPPULOGLIST)
  126. testppudump :
  127. $(MAKE) cleanppulogs ppulogs