Makefile.fpc 5.8 KB

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