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.

68 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. RESOURCES +=
  36. # Final targets
  37. $(TARGET): $(RESOURCES) $(OBJECTS)
  38. $(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
  39. -include $(DEPS)
  40. build/%.c.o: %.c
  41. @mkdir -p $(@D)
  42. $(CC) $(CFLAGS) -c -o $@ $<
  43. build/%.cpp.o: %.cpp
  44. @mkdir -p $(@D)
  45. $(CXX) $(CXXFLAGS) -c -o $@ $<
  46. build/%.cc.o: %.cc
  47. @mkdir -p $(@D)
  48. $(CXX) $(CXXFLAGS) -c -o $@ $<
  49. build/%.m.o: %.m
  50. @mkdir -p $(@D)
  51. $(CC) $(CFLAGS) -c -o $@ $<