Makefile.fpc 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #
  2. # Makefile.fpc for running fpmake
  3. #
  4. [package]
  5. name=fpmkunit
  6. version=3.3.1
  7. [require]
  8. packages=rtl paszlib fcl-process hash libtar
  9. [install]
  10. fpcpackage=y
  11. [default]
  12. fpcdir=../..
  13. [prerules]
  14. #Defines for bootstrapping
  15. TARGET_UNITDIRBS=units_bs/$(SOURCESUFFIX)
  16. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/fpmkunit.ppu units_bs/$(SOURCESUFFIX)/fpmkunit.rst units_bs/$(SOURCESUFFIX)/fpmkunit.o
  17. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/adler.ppu units_bs/$(SOURCESUFFIX)/adler.o units_bs/$(SOURCESUFFIX)/crc.o units_bs/$(SOURCESUFFIX)/crc.ppu
  18. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/gzio.ppu units_bs/$(SOURCESUFFIX)/gzio.o units_bs/$(SOURCESUFFIX)/infblock.o units_bs/$(SOURCESUFFIX)/infblock.ppu
  19. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/infcodes.ppu units_bs/$(SOURCESUFFIX)/infcodes.o units_bs/$(SOURCESUFFIX)/inffast.o units_bs/$(SOURCESUFFIX)/inffast.ppu
  20. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/inftrees.ppu units_bs/$(SOURCESUFFIX)/inftrees.o units_bs/$(SOURCESUFFIX)/infutil.o units_bs/$(SOURCESUFFIX)/infutil.ppu
  21. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/pipes.ppu units_bs/$(SOURCESUFFIX)/pipes.o units_bs/$(SOURCESUFFIX)/process.o units_bs/$(SOURCESUFFIX)/process.ppu units_bs/$(SOURCESUFFIX)/process.rst
  22. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/trees.ppu units_bs/$(SOURCESUFFIX)/trees.o units_bs/$(SOURCESUFFIX)/zbase.o units_bs/$(SOURCESUFFIX)/zbase.ppu units_bs/$(SOURCESUFFIX)/zbase.rst
  23. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/zdeflate.ppu units_bs/$(SOURCESUFFIX)/zdeflate.o units_bs/$(SOURCESUFFIX)/zinflate.o units_bs/$(SOURCESUFFIX)/zinflate.ppu
  24. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/libtar.ppu units_bs/$(SOURCESUFFIX)/libtar.o
  25. CLEAN_FILES+=units_bs/$(SOURCESUFFIX)/zipper.ppu units_bs/$(SOURCESUFFIX)/zipper.o units_bs/$(SOURCESUFFIX)/zipper.rst units_bs/$(SOURCESUFFIX)/zstream.o units_bs/$(SOURCESUFFIX)/zstream.ppu units_bs/$(SOURCESUFFIX)/zstream.rst
  26. # Set NO_UNIT_PROCESS on hosts that do not support the process unit
  27. ifneq ($(findstring $(OS_SOURCE),os2 go32v2),)
  28. NO_UNIT_PROCESS=1
  29. endif
  30. ifdef NO_UNIT_PROCESS
  31. UNIT_PROCESS=-dNO_UNIT_PROCESS
  32. else
  33. UNIT_PROCESS=
  34. USE_PROCESS_DUMMY_DIR=1
  35. ifneq ($(findstring $(OS_SOURCE),win32 win64),)
  36. UNIT_PROCESS+=-Fi../fcl-process/src/win -Fi../fcl-process/src/winall
  37. USE_PROCESS_DUMMY_DIR=0
  38. endif
  39. ifneq ($(findstring $(OS_SOURCE),linux freebsd darwin iphonesim netbsd openbsd solaris haiku aix android dragonfly),)
  40. UNIT_PROCESS+=-Fi../fcl-process/src/unix
  41. USE_PROCESS_DUMMY_DIR=0
  42. endif
  43. ifneq ($(findstring $(OS_SOURCE),os2 emx),)
  44. UNIT_PROCESS+=-Fi../fcl-process/src/os2
  45. #USE_PROCESS_DUMMY_DIR=0 (still uses dummy/process.inc)
  46. endif
  47. ifneq ($(findstring $(OS_SOURCE),amiga morphos aros),)
  48. UNIT_PROCESS+=-Fi../fcl-process/src/amicommon
  49. USE_PROCESS_DUMMY_DIR=0
  50. endif
  51. UNIT_PROCESS+=-Fu../fcl-process/src -Fi../fcl-process/src/$(OS_SOURCE)
  52. ifeq ($(USE_PROCESS_DUMMY_DIR),1)
  53. UNIT_PROCESS+=-Fi../fcl-process/src/dummy
  54. endif
  55. endif
  56. ifdef NO_UNIT_ZIPPER
  57. UNIT_ZIPPER=-dNO_UNIT_ZIPPER
  58. else
  59. UNIT_ZIPPER=-Fu../paszlib/src -Fu../hash/src -Fi../paszlib/src
  60. endif
  61. UNIT_LIBTAR=-Fu../libtar/src
  62. # End of bootstrap-code
  63. FPMAKE_BIN_CLEAN=$(wildcard ./fpmake$(SRCEXEEXT))
  64. ifdef OS_TARGET
  65. FPC_TARGETOPT+=--os=$(OS_TARGET)
  66. endif
  67. ifdef CPU_TARGET
  68. FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
  69. endif
  70. LOCALFPMAKE=./fpmake$(SRCEXEEXT)
  71. # Force -Cg for bootstrap depending on XX_SOURCE for the same targets as
  72. # as those XX_SOURCE (avoid linker warnings about mixing abi and non-abi files of mips-linux)
  73. ifneq ($(findstring $(OS_SOURCE),dragonfly freebsd openbsd netbsd linux solaris),)
  74. ifneq ($(findstring $(CPU_SOURCE),x86_64 mips mipsel),)
  75. override FPCMAKEOPT+=-Cg
  76. endif
  77. endif
  78. [rules]
  79. .NOTPARALLEL:
  80. $(TARGET_UNITDIRBS):
  81. $(MKDIRTREE) $(TARGET_UNITDIRBS)
  82. # We want to have all units inside the single packages/fpmkunit/units/$target directory
  83. bootstrap: $(TARGET_UNITDIRBS)
  84. $(FPCFPMAKE) src/fpmkunit.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(UNITDIR_FPMAKE_RTL)) -FU$(TARGET_UNITDIRBS) $(UNIT_ZIPPER) $(FPCMAKEOPT) $(UNIT_PROCESS) $(UNIT_LIBTAR) $(OPT)
  85. # Old $(FPCFPMAKE) src/fpmkunit.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) -FU$(TARGET_UNITDIRBS) $(UNIT_ZIPPER) $(UNIT_PROCESS) $(UNIT_LIBTAR) $(OPT)
  86. clean_bootstrap:
  87. -$(DELTREE) units_bs
  88. fpmake: fpmake.pp
  89. $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(UNITDIR_FPMAKE_RTL)) $(FPCMAKEOPT) -Fu$(TARGET_UNITDIRBS) $(OPT)
  90. all: fpmake
  91. $(LOCALFPMAKE) compile --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu
  92. smart: fpmake
  93. $(LOCALFPMAKE) compile --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -XX -o -CX
  94. release: fpmake
  95. $(LOCALFPMAKE) compile --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -dRELEASE
  96. debug: fpmake
  97. $(LOCALFPMAKE) compile --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -dDEBUG
  98. # If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
  99. # most often fail because the dependencies are cleared.
  100. # In case of a clean, simply do nothing
  101. ifeq ($(FPMAKE_BIN_CLEAN),)
  102. clean: clean_bootstrap
  103. else
  104. clean: clean_bootstrap
  105. $(FPMAKE_BIN_CLEAN) clean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
  106. endif
  107. # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
  108. # when the package is compiled using fpcmake prior to running this clean using fpmake
  109. ifeq ($(FPMAKE_BIN_CLEAN),)
  110. distclean: $(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall clean_bootstrap
  111. else
  112. distclean: clean_bootstrap
  113. ifdef inUnix
  114. { $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC); 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; }
  115. else
  116. $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
  117. endif
  118. -$(DEL) $(LOCALFPMAKE)
  119. endif
  120. install: fpmake
  121. ifdef UNIXHier
  122. $(LOCALFPMAKE) install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
  123. else
  124. $(LOCALFPMAKE) install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
  125. endif
  126. # distinstall also installs the example-sources
  127. distinstall: fpmake
  128. ifdef UNIXHier
  129. $(LOCALFPMAKE) install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie
  130. else
  131. $(LOCALFPMAKE) install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR) -ie
  132. endif
  133. zipinstall: fpmake
  134. $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT)