Audio plugin host https://kx.studio/carla
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.

171 lines
7.0KB

  1. #!/usr/bin/make -f
  2. # Makefile for tests #
  3. # ------------------ #
  4. # Created by falkTX
  5. #
  6. CWD=..
  7. include $(CWD)/Makefile.mk
  8. # ---------------------------------------------------------------------------------------------------------------------
  9. BINDIR := $(CWD)/../bin
  10. ifeq ($(DEBUG),true)
  11. OBJDIR := $(CWD)/../build/tests/Debug
  12. MODULEDIR := $(CWD)/../build/modules/Debug
  13. else
  14. OBJDIR := $(CWD)/../build/tests/Release
  15. MODULEDIR := $(CWD)/../build/modules/Release
  16. endif
  17. # ---------------------------------------------------------------------------------------------------------------------
  18. BASE_FLAGS += -DBUILDING_CARLA
  19. BASE_FLAGS += -I. -I.. -I../backend -I../includes -I../modules -I../utils
  20. BUILD_CXX_FLAGS += -I$(CWD)/modules
  21. # ---------------------------------------------------------------------------------------------------------------------
  22. PEDANTIC_FLAGS = -pedantic -pedantic-errors
  23. PEDANTIC_FLAGS += -Wall -Wextra -Werror -pipe
  24. PEDANTIC_FLAGS += -Wabi=98 -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization
  25. PEDANTIC_FLAGS += -Wcast-align -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization
  26. PEDANTIC_FLAGS += -Wdouble-promotion -Wfloat-equal -Wlogical-op -Wpointer-arith -Wsign-conversion
  27. PEDANTIC_FLAGS += -Wformat=2 -Woverlength-strings
  28. PEDANTIC_FLAGS += -Wformat-truncation=2 -Wformat-overflow=2
  29. PEDANTIC_FLAGS += -Wstringop-overflow=4
  30. PEDANTIC_FLAGS += -Wmissing-declarations -Wredundant-decls
  31. PEDANTIC_FLAGS += -Wshadow -Wundef -Wuninitialized -Wunused
  32. PEDANTIC_FLAGS += -Wstrict-aliasing -fstrict-aliasing
  33. PEDANTIC_FLAGS += -Wstrict-overflow -fstrict-overflow
  34. PEDANTIC_FLAGS += -Wduplicated-branches -Wduplicated-cond -Wnull-dereference
  35. # -Wstringop-truncation
  36. PEDANTIC_CFLAGS = $(PEDANTIC_FLAGS)
  37. PEDANTIC_CFLAGS += -Wc++-compat
  38. PEDANTIC_CFLAGS += -Winit-self -Wjump-misses-init -Wnested-externs -Wwrite-strings
  39. PEDANTIC_CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
  40. PEDANTIC_CXXFLAGS = $(PEDANTIC_FLAGS)
  41. PEDANTIC_CXXFLAGS += -Wc++0x-compat -Wc++11-compat
  42. PEDANTIC_CXXFLAGS += -Wnon-virtual-dtor -Woverloaded-virtual
  43. PEDANTIC_CXXFLAGS += -Wold-style-cast -Wuseless-cast
  44. PEDANTIC_CXXFLAGS += -Wzero-as-null-pointer-constant
  45. PEDANTIC_CXXFLAGS += -Weffc++
  46. PEDANTIC_CXX03_SKIPS = -Wno-pedantic
  47. PEDANTIC_CXX03_SKIPS += -Wno-zero-as-null-pointer-constant
  48. PEDANTIC_CXX98_SKIPS = $(PEDANTIC_CXX03_SKIPS)
  49. PEDANTIC_CXX98_SKIPS += -Wno-variadic-macros
  50. PEDANTIC_LDFLAGS = -Wl,-rpath,$(BINDIR) -L$(BINDIR)
  51. # ---------------------------------------------------------------------------------------------------------------------
  52. # Set targets
  53. TARGETS = \
  54. ansi-pedantic-test_c_ansi_run \
  55. ansi-pedantic-test_c89_run \
  56. ansi-pedantic-test_c99_run \
  57. ansi-pedantic-test_c11_run \
  58. ansi-pedantic-test_cxx_ansi_run \
  59. ansi-pedantic-test_cxx98_run \
  60. ansi-pedantic-test_cxx03_run \
  61. ansi-pedantic-test_cxx11_run \
  62. carla-host-plugin_run \
  63. carla-engine-sdl
  64. ifeq ($(WASM),true)
  65. TARGETS = carla-engine-sdl$(APP_EXT)
  66. endif
  67. # ---------------------------------------------------------------------------------------------------------------------
  68. all: $(TARGETS)
  69. # ---------------------------------------------------------------------------------------------------------------------
  70. ansi-%_run: $(BINDIR)/ansi-%
  71. $(BINDIR)/ansi-$*
  72. carla-%_run: $(BINDIR)/carla-%
  73. # valgrind $(BINDIR)/carla-$*
  74. valgrind --leak-check=full --show-leak-kinds=all --suppressions=valgrind.supp $(BINDIR)/carla-$*
  75. # ---------------------------------------------------------------------------------------------------------------------
  76. $(BINDIR)/ansi-pedantic-test_c_ansi: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
  77. $(CC) $< $(PEDANTIC_CFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -ansi -o $@
  78. $(BINDIR)/ansi-pedantic-test_c89: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
  79. $(CC) $< $(PEDANTIC_CFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c89 -o $@
  80. $(BINDIR)/ansi-pedantic-test_c99: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
  81. $(CC) $< $(PEDANTIC_CFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c99 -o $@
  82. $(BINDIR)/ansi-pedantic-test_c11: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
  83. $(CC) $< $(PEDANTIC_CFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c11 -o $@
  84. # ---------------------------------------------------------------------------------------------------------------------
  85. $(BINDIR)/ansi-pedantic-test_cxx_ansi: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
  86. $(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_CXX98_SKIPS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -ansi -Wno-effc++ -o $@
  87. $(BINDIR)/ansi-pedantic-test_cxx98: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
  88. $(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_CXX98_SKIPS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++98 -Wno-effc++ -o $@
  89. $(BINDIR)/ansi-pedantic-test_cxx03: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
  90. $(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_CXX03_SKIPS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++03 -Wno-effc++ -o $@
  91. $(BINDIR)/ansi-pedantic-test_cxx11: ansi-pedantic-test.cpp ../backend/Carla*.h ../backend/Carla*.hpp ../includes/*.h
  92. $(CXX) $< $(PEDANTIC_CXXFLAGS) $(PEDANTIC_LDFLAGS) -lcarla_standalone2 -lcarla_utils -std=c++11 -o $@
  93. # ---------------------------------------------------------------------------------------------------------------------
  94. $(BINDIR)/carla-host-plugin: carla-host-plugin.c
  95. $(CC) $< $(PEDANTIC_CFLAGS) $(PEDANTIC_LDFLAGS) -g -O0 -Wno-declaration-after-statement -Wno-pedantic -lcarla_host-plugin -std=c99 -o $@
  96. # ---------------------------------------------------------------------------------------------------------------------
  97. .PHONY: carla-engine-sdl$(APP_EXT)
  98. carla-engine-sdl$(APP_EXT): $(OBJDIR)/carla-engine-sdl.c.o $(OBJDIR)/carla-engine-sdl-extra.cpp.o
  99. $(CC) $^ \
  100. $(CWD)/../build/plugin/Release/carla-host-plugin.cpp.o \
  101. $(MODULEDIR)/carla_engine.a \
  102. $(MODULEDIR)/carla_plugin.a \
  103. $(MODULEDIR)/lilv.a \
  104. $(MODULEDIR)/native-plugins.a \
  105. $(MODULEDIR)/sfzero.a \
  106. $(MODULEDIR)/audio_decoder.a \
  107. $(MODULEDIR)/rtmempool.a \
  108. $(MODULEDIR)/water.a \
  109. $(MODULEDIR)/ysfx.a \
  110. $(MODULEDIR)/zita-resampler.a \
  111. $(SDL_LIBS) --preload-file foolme.mp3 -sALLOW_MEMORY_GROWTH \
  112. -o $@
  113. # ---------------------------------------------------------------------------------------------------------------------
  114. clean:
  115. rm -f $(BINDIR)/ansi-pedantic-test_* $(BINDIR)/carla-host-plugin
  116. debug:
  117. $(MAKE) DEBUG=true
  118. # ---------------------------------------------------------------------------------------------------------------------
  119. $(OBJDIR)/%.c.o: %.c
  120. -@mkdir -p $(OBJDIR)
  121. @echo "Compiling $<"
  122. $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@
  123. $(OBJDIR)/%.cpp.o: %.cpp
  124. -@mkdir -p $(OBJDIR)
  125. @echo "Compiling $<"
  126. $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
  127. # ---------------------------------------------------------------------------------------------------------------------