Makefile.fpc 5.0 KB

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