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.

67 lines
1.2KB

  1. ifdef VERSION
  2. FLAGS += -DVERSION=$(VERSION)
  3. endif
  4. RACK_DIR ?= .
  5. include $(RACK_DIR)/arch.mk
  6. # Generate dependency files alongside the object files
  7. FLAGS += -MMD -MP
  8. FLAGS += -g
  9. # Optimization
  10. FLAGS += -O3 -march=nocona -ffast-math -fno-finite-math-only
  11. FLAGS += -Wall -Wextra -Wno-unused-parameter
  12. ifneq ($(ARCH), mac)
  13. CXXFLAGS += -Wsuggest-override
  14. endif
  15. CXXFLAGS += -std=c++11
  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 $@ $<