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.

compile.mk 1.2KB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ifdef VERSION
  2. FLAGS += -DVERSION=$(VERSION)
  3. endif
  4. RACK_DIR ?= .
  5. # Generate dependency files alongside the object files
  6. FLAGS += -MMD
  7. FLAGS += -g
  8. # Optimization
  9. FLAGS += -O3 -march=nocona -ffast-math -fno-finite-math-only
  10. FLAGS += -Wall -Wextra -Wno-unused-parameter
  11. ifneq ($(ARCH), mac)
  12. CXXFLAGS += -Wsuggest-override
  13. endif
  14. CXXFLAGS += -std=c++11
  15. include $(RACK_DIR)/arch.mk
  16. ifeq ($(ARCH), lin)
  17. FLAGS += -DARCH_LIN
  18. endif
  19. ifeq ($(ARCH), mac)
  20. FLAGS += -DARCH_MAC
  21. CXXFLAGS += -stdlib=libc++
  22. LDFLAGS += -stdlib=libc++
  23. MAC_SDK_FLAGS = -mmacosx-version-min=10.7
  24. FLAGS += $(MAC_SDK_FLAGS)
  25. LDFLAGS += $(MAC_SDK_FLAGS)
  26. endif
  27. ifeq ($(ARCH), win)
  28. FLAGS += -DARCH_WIN
  29. FLAGS += -D_USE_MATH_DEFINES
  30. endif
  31. CFLAGS += $(FLAGS)
  32. CXXFLAGS += $(FLAGS)
  33. OBJECTS += $(patsubst %, build/%.o, $(SOURCES))
  34. DEPS = $(patsubst %, build/%.d, $(SOURCES))
  35. # Final targets
  36. $(TARGET): $(OBJECTS)
  37. $(CXX) -o $@ $^ $(LDFLAGS)
  38. -include $(DEPS)
  39. build/%.c.o: %.c
  40. @mkdir -p $(@D)
  41. $(CC) $(CFLAGS) -c -o $@ $<
  42. build/%.cpp.o: %.cpp
  43. @mkdir -p $(@D)
  44. $(CXX) $(CXXFLAGS) -c -o $@ $<
  45. build/%.cc.o: %.cc
  46. @mkdir -p $(@D)
  47. $(CXX) $(CXXFLAGS) -c -o $@ $<
  48. build/%.m.o: %.m
  49. @mkdir -p $(@D)
  50. $(CC) $(CFLAGS) -c -o $@ $<