2
0

Makefile.fpc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. #
  2. # Makefile.fpc for running fpmake
  3. #
  4. [require]
  5. packages=rtl fpmkunit fcl-json fcl-process libtar paszlib
  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. ifndef DISABLE_FPMAKE_BUILD_UNIT
  48. FPMAKE_OPT+=-bu
  49. endif
  50. ifndef BUILDFULLNATIVE
  51. FPMAKE_OPT+=-scp
  52. endif
  53. .NOTPARALLEL:
  54. fpmake$(SRCEXEEXT): fpmake.pp $(SUB_FPMAKE_SRCS) fpmake_add.inc fpmake_proc.inc
  55. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  56. all: fpmake$(SRCEXEEXT)
  57. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  58. smart: fpmake$(SRCEXEEXT)
  59. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  60. release: fpmake$(SRCEXEEXT)
  61. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  62. debug: fpmake$(SRCEXEEXT)
  63. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  64. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  65. # most often fail because the dependencies are cleared.
  66. # In case of a clean, simply do nothing
  67. ifeq ($(FPMAKE_BIN_CLEAN),)
  68. clean:
  69. else
  70. clean:
  71. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  72. endif
  73. CLEAN_TARGET_DIRS=$(subst /Makefile, ,$(wildcard */Makefile))
  74. %_distclean:
  75. $(MAKE) -C $* distclean
  76. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  77. # when the package is compiled using fpcmake prior to running this clean using fpmake
  78. ifeq ($(FPMAKE_BIN_CLEAN),)
  79. distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS))
  80. else
  81. distclean:
  82. ifdef inUnix
  83. { $(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; }
  84. else
  85. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  86. endif
  87. -$(DEL) $(LOCALFPMAKE)
  88. -$(DEL) fpmake.o
  89. -$(DEL) fpmake.dbg
  90. endif
  91. cleanall: distclean
  92. install: fpmake$(SRCEXEEXT)
  93. ifdef UNIXHier
  94. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
  95. else
  96. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
  97. endif
  98. # distinstall also installs the example-sources and omits the location of the source-
  99. # files from the fpunits.cfg files.
  100. distinstall: fpmake$(SRCEXEEXT)
  101. ifdef UNIXHier
  102. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  103. else
  104. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  105. endif
  106. zipinstall: fpmake$(SRCEXEEXT)
  107. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  108. zipdistinstall: fpmake$(SRCEXEEXT)
  109. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
  110. zipsourceinstall: fpmake$(SRCEXEEXT)
  111. ifdef UNIXHier
  112. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
  113. else
  114. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
  115. endif
  116. #####################################################################
  117. # PPU testing targets
  118. #####################################################################
  119. PPULIST:=$(wildcard */units/$(TARGETSUFFIX)/*.ppu) $(wildcard units/$(TARGETSUFFIX)/*.ppu)
  120. PPULOGLIST:=$(subst .ppu,.log-ppu,$(PPULIST))
  121. RMPPULOGLIST:=$(subst .ppu,.rm-log-ppu,$(PPULIST))
  122. ALLPPUDIRS:=$(wildcard units/*) $(wildcard */units/*)
  123. .PHONY : ppulogs cleanppulogs testppudump $(RMPPULOGLIST)
  124. ppulogs : $(PPULOGLIST)
  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 list of PPU directories is "$(ALLPPUDIRS)"
  134. echo PPU list is "$(PPULIST)"
  135. echo PPULOG list is "$(PPULOGLIST)"
  136. cleanppulogs : $(RMPPULOGLIST)
  137. testppudump :
  138. $(MAKE) cleanppulogs
  139. $(MAKE) ppulogs