You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.0KB

  1. include $(RACK_DIR)/arch.mk
  2. # The install location for `make install`
  3. DEP_LOCAL ?= dep
  4. $(shell mkdir -p $(DEP_LOCAL))
  5. DEP_PATH := $(abspath $(DEP_LOCAL))
  6. DEP_FLAGS += -g -O3
  7. # This is needed for Rack for DAWs.
  8. # Static libs don't usually compiled with -fPIC, but since we're including them in a shared library, it's needed.
  9. DEP_FLAGS += -fPIC
  10. # Define compiler/linker target if cross-compiling
  11. ifdef CROSS_COMPILE
  12. DEP_FLAGS += --target=$(MACHINE)
  13. endif
  14. ifdef ARCH_X64
  15. DEP_FLAGS += -march=nehalem
  16. endif
  17. ifdef ARCH_ARM64
  18. DEP_FLAGS += -march=armv8-a+fp+simd
  19. endif
  20. ifdef ARCH_MAC
  21. DEP_MAC_SDK_FLAGS := -mmacosx-version-min=10.9
  22. DEP_FLAGS += $(DEP_MAC_SDK_FLAGS)
  23. DEP_CXXFLAGS += -stdlib=libc++
  24. DEP_LDFLAGS += -stdlib=libc++
  25. endif
  26. DEP_CFLAGS += $(DEP_FLAGS)
  27. DEP_CXXFLAGS += $(DEP_FLAGS)
  28. DEP_LDFLAGS += $(DEP_FLAGS)
  29. # Commands
  30. WGET := wget -c
  31. UNTAR := tar xf
  32. UNZIP := unzip -o
  33. CONFIGURE := ./configure --prefix="$(DEP_PATH)"
  34. CMAKE := cmake
  35. # Cmake 4 no longer emulates behavior from Cmake <3.5. But most libraries are fine if we use policies from a higher Cmake version.
  36. CMAKE += -DCMAKE_POLICY_VERSION_MINIMUM=3.5
  37. ifdef ARCH_WIN
  38. CMAKE += -DCMAKE_SYSTEM_NAME=Windows
  39. endif
  40. # We must specify the MSYS generator if in an MSYS shell
  41. ifdef MSYSTEM
  42. CMAKE += -G "MSYS Makefiles"
  43. endif
  44. ifdef ARCH_MAC
  45. CMAKE += -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
  46. endif
  47. ifdef ARCH_LIN
  48. CMAKE += -DCMAKE_SYSTEM_NAME=Linux
  49. endif
  50. CMAKE += -DCMAKE_INSTALL_PREFIX="$(DEP_PATH)"
  51. # Some platforms try to install to lib64
  52. CMAKE += -DCMAKE_INSTALL_LIBDIR=lib
  53. ifdef ARCH_MAC
  54. SHA256SUM := shasum -a 256
  55. SED := sed -i ''
  56. else
  57. SHA256SUM := sha256sum
  58. SED := sed -i
  59. endif
  60. SHA256 := sha256check() { echo "$$2 $$1" | $(SHA256SUM) -c; }; sha256check
  61. # Export environment for all dependency targets
  62. $(DEPS): export CFLAGS = $(DEP_CFLAGS)
  63. $(DEPS): export CXXFLAGS = $(DEP_CXXFLAGS)
  64. $(DEPS): export LDFLAGS = $(DEP_LDFLAGS)
  65. dep: $(DEPS)
  66. cleandep:
  67. ifeq ($(DEP_LOCAL), .)
  68. $(error Refusing to clean cwd)
  69. endif
  70. rm -rfv $(DEP_LOCAL)
  71. .PHONY: dep