Makefile.fpc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. .NOTPARALLEL:
  86. PPC_TARGETS=i386 m68k powerpc sparc arm x86_64 powerpc64 mips mipsel avr jvm i8086 aarch64 sparc64
  87. CLEAN_TARGETS=$(addsuffix _clean,$(sort $(PPC_TARGETS)))
  88. DISTCLEAN_TARGETS=$(addsuffix _distclean,$(sort $(PPC_TARGETS)))
  89. INSTALL_TARGETS=$(addsuffix _exe_install,$(sort $(PPC_TARGETS)))
  90. .PHONY: $(PPC_TARGETS) $(CLEAN_TARGETS) $(DISTCLEAN_TARGETS) $(INSTALL_TARGETS)
  91. $(PPC_TARGETS):
  92. $(MAKE) PPC_TARGET=$@ all
  93. $(CLEAN_TARGETS):
  94. $(MAKE) clean PPC_TARGET=$(subst _clean,,$@)
  95. $(DISTCLEAN_TARGETS):
  96. $(MAKE) distclean PPC_TARGET=$(subst _distclean,,$@)
  97. $(INSTALL_TARGETS):
  98. $(MAKE) all install PPC_TARGET=$(subst _exe_install,,$@)
  99. all_targets: $(PPC_TARGETS)
  100. all_targets_install: $(INSTALL_TARGETS)
  101. fpmake$(SRCEXEEXT): fpmake.pp
  102. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
  103. all: fpmake$(SRCEXEEXT)
  104. $(LOCALFPMAKE) compile $(FPMAKE_OPT)
  105. smart: fpmake$(SRCEXEEXT)
  106. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
  107. release: fpmake$(SRCEXEEXT)
  108. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
  109. debug: fpmake$(SRCEXEEXT)
  110. $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
  111. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  112. # most often fail because the dependencies are cleared.
  113. # In case of a clean, simply do nothing
  114. ifeq ($(FPMAKE_BIN_CLEAN),)
  115. clean:
  116. else
  117. clean:
  118. $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
  119. endif
  120. CLEAN_TARGET_DIRS=$(subst /Makefile.fpc, ,$(wildcard */Makefile.fpc))
  121. %_distclean:
  122. $(MAKE) -C $* distclean
  123. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  124. # when the package is compiled using fpcmake prior to running this clean using fpmake
  125. ifeq ($(FPMAKE_BIN_CLEAN),)
  126. distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS))
  127. else
  128. distclean:
  129. ifdef inUnix
  130. { $(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; }
  131. else
  132. $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
  133. endif
  134. -$(DEL) $(LOCALFPMAKE)
  135. -$(DEL) fpmake.o
  136. -$(DEL) fpmake.dbg
  137. endif
  138. cleanall: distclean
  139. install: fpmake$(SRCEXEEXT)
  140. ifdef UNIXHier
  141. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
  142. else
  143. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
  144. endif
  145. # distinstall also installs the example-sources and omits the location of the source-
  146. # files from the fpunits.cfg files.
  147. distinstall: fpmake$(SRCEXEEXT)
  148. ifdef UNIXHier
  149. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  150. else
  151. $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --baseinstalldir=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie -fsp 0
  152. endif
  153. zipinstall: fpmake$(SRCEXEEXT)
  154. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
  155. zipdistinstall: fpmake$(SRCEXEEXT)
  156. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie -fsp 0
  157. zipsourceinstall: fpmake$(SRCEXEEXT)
  158. ifdef UNIXHier
  159. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=share/src/fpc-\$$\(PACKAGEVERSION\)/$(INSTALL_FPCSUBDIR)/\$$\(PACKAGEDIRECTORY\)
  160. else
  161. $(LOCALFPMAKE) archive $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) --prefix=source\\$(INSTALL_FPCSUBDIR)\\\$$\(PACKAGEDIRECTORY\)
  162. endif