Makefile.fpc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. #
  2. # Makefile.fpc for running fpmake
  3. #
  4. [package]
  5. name=ide
  6. version=3.3.1
  7. [require]
  8. packages=rtl fpmkunit rtl-extra fv chm regexpr
  9. packages_go32v2=graph
  10. [install]
  11. fpcpackage=y
  12. fpcsubdir=ide
  13. [default]
  14. fpcdir=../..
  15. [prerules]
  16. # Translate INSTALL_UNITDIR to fpmake's --unitinstalldir parameter
  17. ifdef INSTALL_UNITDIR
  18. FPMAKE_INSTALL_OPT+=--unitinstalldir=$(INSTALL_UNITDIR)
  19. endif
  20. ifdef INSTALL_BINDIR
  21. FPMAKE_INSTALL_OPT+=--bininstalldir=$(INSTALL_BINDIR)
  22. endif
  23. # Translate OS_TARGET and CPU_TARGET to fpmake's --os and --cpu parameters
  24. ifdef OS_TARGET
  25. FPC_TARGETOPT+=--os=$(OS_TARGET)
  26. endif
  27. ifdef CPU_TARGET
  28. FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
  29. endif
  30. FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT))
  31. LOCALFPMAKE=./fpmake$(SRCEXEEXT)
  32. # do not add -d$(CPU_TARGET)
  33. override NOCPUDEF=1
  34. # This list should be the same as in fpcbuild/Makefile.fpc and in fpcsrc/Makefile.fpc
  35. GDBMI_DEFAULT_OS_LIST=aix darwin freebsd haiku linux netbsd openbsd solaris win32 win64
  36. [rules]
  37. # Do not pass the Makefile's unit and binary target locations. Fpmake uses it's own.
  38. override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
  39. override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
  40. # Do not pass the package-unitdirectories. Fpmake adds those and this way they don't apear in the .fpm
  41. override FPCOPT:=$(filter-out $(addprefix -Fu,$(COMPILER_UNITDIR)),$(FPCOPT))# Compose general fpmake-parameters
  42. # Compose general fpmake-parameters
  43. ifdef FPMAKEOPT
  44. FPMAKE_OPT+=$(FPMAKEOPT)
  45. endif
  46. FPMAKE_OPT+=--localunitdir=../..
  47. FPMAKE_OPT+=--globalunitdir=../../packages
  48. FPMAKE_OPT+=$(FPC_TARGETOPT)
  49. FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
  50. FPMAKE_OPT+=--compiler=$(FPC)
  51. FPMAKE_OPT+=-bu
  52. ifdef SUB_TARGET
  53. FPMAKE_OPT+=--subtarget=$(SUB_TARGET)
  54. endif
  55. ifdef NOGDB
  56. FPMAKE_OPT+=--NoGDB=1
  57. else
  58. ifndef NOGDBMI
  59. ifneq ($(findstring $(OS_TARGET),$(GDBMI_DEFAULT_OS_LIST)),)
  60. GDBMI=1
  61. endif
  62. endif # NOGDBMI
  63. ifdef NOGDBMI
  64. FPMAKE_OPT+=--NOGDBMI=1
  65. endif
  66. ifdef GDBMI
  67. FPMAKE_OPT+=--GDBMI=1
  68. # If the rtl does not require libc, then
  69. # IDE compiled with GDBMI should be a static executable
  70. # and can thus be cross-compiled
  71. ifeq ($(findstring $(OS_TARGET),aix beos darwin haiku solaris),)
  72. GDBMI_IS_STATIC=1
  73. endif
  74. endif
  75. endif # NOGDB
  76. ifndef GDBMI_IS_STATIC
  77. ifndef BUILDFULLNATIVE
  78. # Omit executable is only required if generated executable is not static
  79. FPMAKE_OPT+=-scp
  80. endif
  81. endif # GDBMI_IS_STATIC
  82. ifdef PPC_TARGET
  83. FPMAKE_OPT+=--CompilerTarget=$(PPC_TARGET)
  84. endif
  85. ifdef LLVM
  86. FPMAKE_OPT+=--LLVM=1
  87. endif
  88. ifdef NOLLVM
  89. FPMAKE_OPT+=--NOLLVM=1
  90. endif
  91. .NOTPARALLEL:
  92. PPC_TARGETS=i386 m68k powerpc sparc arm x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64 riscv32 riscv64 xtensa wasm32 z80
  93. CLEAN_TARGETS=$(addsuffix _clean,$(sort $(PPC_TARGETS)))
  94. DISTCLEAN_TARGETS=$(addsuffix _distclean,$(sort $(PPC_TARGETS)))
  95. INSTALL_TARGETS=$(addsuffix _exe_install,$(sort $(PPC_TARGETS)))
  96. .PHONY: $(PPC_TARGETS) $(CLEAN_TARGETS) $(DISTCLEAN_TARGETS) $(INSTALL_TARGETS)
  97. $(PPC_TARGETS):
  98. $(MAKE) PPC_TARGET=$@ all
  99. $(CLEAN_TARGETS):
  100. $(MAKE) clean PPC_TARGET=$(subst _clean,,$@)
  101. $(DISTCLEAN_TARGETS):
  102. $(MAKE) distclean PPC_TARGET=$(subst _distclean,,$@)
  103. $(INSTALL_TARGETS):
  104. $(MAKE) all install PPC_TARGET=$(subst _exe_install,,$@)
  105. all_targets: $(PPC_TARGETS)
  106. all_targets_install: $(INSTALL_TARGETS)
  107. fpmake$(SRCEXEEXT): fpmake.pp
  108. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  109. all: fpmake$(SRCEXEEXT)
  110. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  111. smart: fpmake$(SRCEXEEXT)
  112. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  113. release: fpmake$(SRCEXEEXT)
  114. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  115. debug: fpmake$(SRCEXEEXT)
  116. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  117. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  118. # most often fail because the dependencies are cleared.
  119. # In case of a clean, simply do nothing
  120. ifeq ($(FPMAKE_BIN_CLEAN),)
  121. clean:
  122. else
  123. clean:
  124. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  125. endif
  126. CLEAN_TARGET_DIRS=$(subst /Makefile.fpc, ,$(wildcard */Makefile.fpc))
  127. %_distclean:
  128. $(MAKE) -C $* distclean
  129. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  130. # when the package is compiled using fpcmake prior to running this clean using fpmake
  131. ifeq ($(FPMAKE_BIN_CLEAN),)
  132. distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS))
  133. else
  134. distclean:
  135. ifdef inUnix
  136. { $(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; }
  137. else
  138. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  139. endif
  140. -$(DEL) $(LOCALFPMAKE)
  141. -$(DEL) fpmake.o
  142. -$(DEL) fpmake.dbg
  143. endif
  144. cleanall: distclean
  145. install: fpmake$(SRCEXEEXT)
  146. ifdef UNIXHier
  147. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
  148. else
  149. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
  150. endif
  151. # distinstall also installs the example-sources and omits the location of the source-
  152. # files from the fpunits.cfg files.
  153. distinstall: fpmake$(SRCEXEEXT)
  154. ifdef UNIXHier
  155. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  156. else
  157. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  158. endif
  159. zipinstall: fpmake$(SRCEXEEXT)
  160. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  161. zipdistinstall: fpmake$(SRCEXEEXT)
  162. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
  163. zipsourceinstall: fpmake$(SRCEXEEXT)
  164. ifdef UNIXHier
  165. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
  166. else
  167. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
  168. endif