Makefile.fpc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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: fpmake.pp
  44. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  45. all: fpmake
  46. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  47. smart: fpmake
  48. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  49. release: fpmake
  50. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  51. debug: fpmake
  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
  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
  88. distinstall: fpmake
  89. ifdef UNIXHier
  90. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie
  91. else
  92. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie
  93. endif
  94. zipinstall: fpmake
  95. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  96. zipdistinstall: fpmake
  97. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie
  98. #####################################################################
  99. # PPU testing targets
  100. #####################################################################
  101. PPULIST:=$(wildcard */units/*/*.ppu) $(wildcard units/*/*.ppu)
  102. PPULOGLIST:=$(subst .ppu,.log-ppu,$(PPULIST))
  103. RMPPULOGLIST:=$(subst .ppu,.rm-log-ppu,$(PPULIST))
  104. .PHONY : ppulogs cleanppulogs testppudump $(RMPPULOGLIST)
  105. ppulogs : $(PPULOGLIST)
  106. vpath %.ppu $(ALLPPUDIRS)
  107. vpath %.log-ppu $(ALLPPUDIRS)
  108. vpath %.rm-log-ppu $(ALLPPUDIRS)
  109. %.log-ppu : %.ppu ../compiler/utils/ppudump$(EXEEXT)
  110. ..$(PATHSEP)compiler$(PATHSEP)utils$(PATHSEP)ppudump -VA -M $< > $@
  111. %.rm-log-ppu : %.ppu ../compiler/utils/ppudump$(EXEEXT)
  112. -$(RMPROG) $<
  113. ../compiler/utils/ppudump$(EXEEXT):
  114. $(MAKE) -C $(COMPILERDIR)/utils ppudump$(EXEEXT)
  115. ppuinfo :
  116. echo PPU list is "$(PPULIST)"
  117. echo PPULOG list is "$(PPULOGLIST)"
  118. cleanppulogs : $(RMPPULOGLIST)
  119. testppudump :
  120. $(MAKE) cleanppulogs ppulogs