Makefile.fpc 5.2 KB

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