Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ifeq (${MSYSTEM} , MINGW32)
  2. MINGW = 1
  3. endif
  4. WORKDIR = `pwd`
  5. CC = gcc
  6. CXX = g++
  7. AR = ar
  8. LD = g++
  9. WINDRES = windres
  10. INC =
  11. RESINC =
  12. LIBDIR =
  13. ifdef MINGW
  14. CFLAGS = -std=gnu++0x -Wall -I/usr/include -I/usr/include/SDL -D_GNU_SOURCE=1 -Dmain=SDL_main
  15. LIB = /usr/lib/libjack.lib /usr/lib/libSDL_gfx.dll.a /usr/lib/SDL_ttf.lib
  16. LDFLAGS = -L/usr/lib -lmingw32 -lSDLmain -lSDL -mwindows
  17. else
  18. CFLAGS = -std=gnu++0x -Wall `sdl-config --cflags`
  19. LIB =
  20. LDFLAGS = `sdl-config --libs` `pkg-config x11 --libs` `pkg-config SDL_ttf --libs` `pkg-config SDL_gfx --libs` `pkg-config jack --libs`
  21. endif
  22. INC_DEBUG = $(INC)
  23. CFLAGS_DEBUG = $(CFLAGS) -g
  24. RESINC_DEBUG = $(RESINC)
  25. RCFLAGS_DEBUG = $(RCFLAGS)
  26. LIBDIR_DEBUG = $(LIBDIR)
  27. LIB_DEBUG = $(LIB)
  28. LDFLAGS_DEBUG = $(LDFLAGS)
  29. OBJDIR_DEBUG = ./obj/Debug
  30. BINDIR_DEBUG = ./bin/Debug
  31. DEP_DEBUG =
  32. OUT_DEBUG = $(BINDIR_DEBUG)/loopidity-dbg
  33. INC_RELEASE = $(INC)
  34. CFLAGS_RELEASE = $(CFLAGS) -O3
  35. RESINC_RELEASE = $(RESINC)
  36. RCFLAGS_RELEASE = $(RCFLAGS)
  37. LIBDIR_RELEASE = $(LIBDIR)
  38. LIB_RELEASE = $(LIB)
  39. LDFLAGS_RELEASE = $(LDFLAGS) -s
  40. OBJDIR_RELEASE = ./obj/Release
  41. BINDIR_RELEASE = ./bin/Release
  42. DEP_RELEASE =
  43. OUT_RELEASE = $(BINDIR_RELEASE)/loopidity
  44. ASSETS_DIR = ../assets
  45. ifdef MINGW
  46. SYSBIN_DIR = /usr/bin
  47. endif
  48. OBJ_DEBUG = $(OBJDIR_DEBUG)/__/src/jack_io.o \
  49. $(OBJDIR_DEBUG)/__/src/loopidity.o \
  50. $(OBJDIR_DEBUG)/__/src/loopidity_sdl.o \
  51. $(OBJDIR_DEBUG)/__/src/main.o \
  52. $(OBJDIR_DEBUG)/__/src/scene.o \
  53. $(OBJDIR_DEBUG)/__/src/scene_sdl.o \
  54. $(OBJDIR_DEBUG)/__/src/trace.o
  55. OBJ_RELEASE = $(OBJDIR_RELEASE)/__/src/jack_io.o \
  56. $(OBJDIR_RELEASE)/__/src/loopidity.o \
  57. $(OBJDIR_RELEASE)/__/src/loopidity_sdl.o \
  58. $(OBJDIR_RELEASE)/__/src/main.o \
  59. $(OBJDIR_RELEASE)/__/src/scene.o \
  60. $(OBJDIR_RELEASE)/__/src/scene_sdl.o \
  61. $(OBJDIR_RELEASE)/__/src/trace.o
  62. ASSETS = histogram_gradient.bmp \
  63. loop_gradient.argb.bmp \
  64. scope_gradient.bmp \
  65. Purisa.ttf
  66. all: debug release
  67. clean: clean_debug clean_release
  68. debug: before_debug out_debug after_debug
  69. before_debug:
  70. @echo ; echo "building debug configuration" ;
  71. @test -d $(BINDIR_DEBUG) || mkdir -p $(BINDIR_DEBUG)
  72. @test -d $(OBJDIR_DEBUG)/__/src || mkdir -p $(OBJDIR_DEBUG)/__/src
  73. after_debug: $(ASSETS) $(WINLIBS)
  74. out_debug: before_debug $(OBJ_DEBUG) $(DEP_DEBUG)
  75. @echo "linking debug binary"
  76. @$(LD) $(LIBDIR_DEBUG) -o $(OUT_DEBUG) $(OBJ_DEBUG) $(LDFLAGS_DEBUG) $(LIB_DEBUG)
  77. $(OBJ_DEBUG): $(OBJDIR_DEBUG)/__/src/%.o: ../src/%.cpp
  78. @echo " -> compiling $*.cpp"
  79. @$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c $< -o $@
  80. clean_debug:
  81. @rm -f $(OBJ_DEBUG) $(OUT_DEBUG)
  82. @rm -rf $(BINDIR_DEBUG)
  83. @rm -rf $(OBJDIR_DEBUG)/__/src
  84. release: before_release out_release after_release
  85. before_release:
  86. @echo ; echo "building release configuration" ;
  87. @test -d $(BINDIR_RELEASE) || mkdir -p $(BINDIR_RELEASE)
  88. @test -d $(OBJDIR_RELEASE)/__/src || mkdir -p $(OBJDIR_RELEASE)/__/src
  89. after_release: $(ASSETS) $(WINLIBS)
  90. out_release: before_release $(OBJ_RELEASE) $(DEP_RELEASE)
  91. @echo "linking release binary"
  92. @$(LD) $(LIBDIR_RELEASE) -o $(OUT_RELEASE) $(OBJ_RELEASE) $(LDFLAGS_RELEASE) $(LIB_RELEASE)
  93. $(OBJ_RELEASE): $(OBJDIR_RELEASE)/__/src/%.o: ../src/%.cpp
  94. @echo " -> compiling $*.cpp"
  95. @$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c $< -o $@
  96. clean_release:
  97. @rm -f $(OBJ_RELEASE) $(OUT_RELEASE)
  98. @rm -rf $(BINDIR_RELEASE)
  99. @rm -rf $(OBJDIR_RELEASE)/__/src
  100. $(ASSETS):
  101. @[ ! -d $(BINDIR_DEBUG) ] || [ -f $(BINDIR_DEBUG)/$@ ] || \
  102. ( echo "copying asset to debug bin directory: '$@'" ; \
  103. cp $(ASSETS_DIR)/$@ $(BINDIR_DEBUG)/$@ )
  104. @[ ! -d $(BINDIR_RELEASE) ] || [ -f $(BINDIR_RELEASE)/$@ ] || \
  105. ( echo "copying asset to release bin directory: '$@'" ; \
  106. cp $(ASSETS_DIR)/$@ $(BINDIR_RELEASE)/$@ )
  107. .PHONY: before_debug after_debug clean_debug before_release after_release clean_release