Makefile.fpc 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 NOGDB
  53. FPMAKE_OPT+=--NoGDB=1
  54. else
  55. ifndef NOGDBMI
  56. ifneq ($(findstring $(OS_TARGET),$(GDBMI_DEFAULT_OS_LIST)),)
  57. GDBMI=1
  58. endif
  59. endif # NOGDBMI
  60. ifdef NOGDBMI
  61. FPMAKE_OPT+=--NOGDBMI=1
  62. endif
  63. ifdef GDBMI
  64. FPMAKE_OPT+=--GDBMI=1
  65. # If the rtl does not require libc, then
  66. # IDE compiled with GDBMI should be a static executable
  67. # and can thus be cross-compiled
  68. ifeq ($(findstring $(OS_TARGET),aix beos darwin haiku solaris),)
  69. GDBMI_IS_STATIC=1
  70. endif
  71. endif
  72. endif # NOGDB
  73. ifndef GDBMI_IS_STATIC
  74. ifndef BUILDFULLNATIVE
  75. # Omit executable is only required if generated executable is not static
  76. FPMAKE_OPT+=-scp
  77. endif
  78. endif # GDBMI_IS_STATIC
  79. ifdef PPC_TARGET
  80. FPMAKE_OPT+=--CompilerTarget=$(PPC_TARGET)
  81. endif
  82. ifdef LLVM
  83. FPMAKE_OPT+=--LLVM=1
  84. endif
  85. ifdef NOLLVM
  86. FPMAKE_OPT+=--NOLLVM=1
  87. endif
  88. .NOTPARALLEL:
  89. PPC_TARGETS=i386 m68k powerpc sparc arm x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64 riscv32 riscv64 xtensa wasm32 z80
  90. CLEAN_TARGETS=$(addsuffix _clean,$(sort $(PPC_TARGETS)))
  91. DISTCLEAN_TARGETS=$(addsuffix _distclean,$(sort $(PPC_TARGETS)))
  92. INSTALL_TARGETS=$(addsuffix _exe_install,$(sort $(PPC_TARGETS)))
  93. .PHONY: $(PPC_TARGETS) $(CLEAN_TARGETS) $(DISTCLEAN_TARGETS) $(INSTALL_TARGETS)
  94. $(PPC_TARGETS):
  95. $(MAKE) PPC_TARGET=$@ all
  96. $(CLEAN_TARGETS):
  97. $(MAKE) clean PPC_TARGET=$(subst _clean,,$@)
  98. $(DISTCLEAN_TARGETS):
  99. $(MAKE) distclean PPC_TARGET=$(subst _distclean,,$@)
  100. $(INSTALL_TARGETS):
  101. $(MAKE) all install PPC_TARGET=$(subst _exe_install,,$@)
  102. all_targets: $(PPC_TARGETS)
  103. all_targets_install: $(INSTALL_TARGETS)
  104. fpmake$(SRCEXEEXT): fpmake.pp
  105. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  106. all: fpmake$(SRCEXEEXT)
  107. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  108. smart: fpmake$(SRCEXEEXT)
  109. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  110. release: fpmake$(SRCEXEEXT)
  111. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  112. debug: fpmake$(SRCEXEEXT)
  113. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  114. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  115. # most often fail because the dependencies are cleared.
  116. # In case of a clean, simply do nothing
  117. ifeq ($(FPMAKE_BIN_CLEAN),)
  118. clean:
  119. else
  120. clean:
  121. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  122. endif
  123. CLEAN_TARGET_DIRS=$(subst /Makefile.fpc, ,$(wildcard */Makefile.fpc))
  124. %_distclean:
  125. $(MAKE) -C $* distclean
  126. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  127. # when the package is compiled using fpcmake prior to running this clean using fpmake
  128. ifeq ($(FPMAKE_BIN_CLEAN),)
  129. distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS))
  130. else
  131. distclean:
  132. ifdef inUnix
  133. { $(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; }
  134. else
  135. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  136. endif
  137. -$(DEL) $(LOCALFPMAKE)
  138. -$(DEL) fpmake.o
  139. -$(DEL) fpmake.dbg
  140. endif
  141. cleanall: distclean
  142. install: fpmake$(SRCEXEEXT)
  143. ifdef UNIXHier
  144. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
  145. else
  146. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
  147. endif
  148. # distinstall also installs the example-sources and omits the location of the source-
  149. # files from the fpunits.cfg files.
  150. distinstall: fpmake$(SRCEXEEXT)
  151. ifdef UNIXHier
  152. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  153. else
  154. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  155. endif
  156. zipinstall: fpmake$(SRCEXEEXT)
  157. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  158. zipdistinstall: fpmake$(SRCEXEEXT)
  159. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
  160. zipsourceinstall: fpmake$(SRCEXEEXT)
  161. ifdef UNIXHier
  162. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
  163. else
  164. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
  165. endif