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.

Makefile.inc 882B

8 years ago
8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. FLAGS += -MMD
  2. CXXFLAGS += -std=c++11
  3. ifeq ($(ARCH), lin)
  4. CC ?= gcc
  5. CXX ?= g++
  6. FLAGS += -DLINUX
  7. endif
  8. ifeq ($(ARCH), mac)
  9. CC ?= clang
  10. CXX ?= clang++
  11. FLAGS += -DAPPLE
  12. CXXFLAGS += -stdlib=libc++
  13. LDFLAGS += -stdlib=libc++
  14. endif
  15. ifeq ($(ARCH), win)
  16. CC ?= x86_64-w64-mingw32-gcc
  17. CXX ?= x86_64-w64-mingw32-g++
  18. FLAGS += -DWINDOWS -D_USE_MATH_DEFINES
  19. endif
  20. CFLAGS := $(FLAGS) $(CFLAGS)
  21. CXXFLAGS := $(FLAGS) $(CXXFLAGS)
  22. OBJECTS += $(patsubst %, build/%.o, $(SOURCES))
  23. DEPS = $(patsubst %, build/%.d, $(SOURCES))
  24. # Final targets
  25. $(TARGET): $(OBJECTS)
  26. $(CXX) -o $@ $^ $(LDFLAGS)
  27. # Object targets
  28. -include $(DEPS)
  29. build/%.c.o: %.c
  30. @mkdir -p $(@D)
  31. $(CC) $(CFLAGS) -c -o $@ $<
  32. build/%.cpp.o: %.cpp
  33. @mkdir -p $(@D)
  34. $(CXX) $(CXXFLAGS) -c -o $@ $<
  35. build/%.cc.o: %.cc
  36. @mkdir -p $(@D)
  37. $(CXX) $(CXXFLAGS) -c -o $@ $<
  38. build/%.m.o: %.m
  39. @mkdir -p $(@D)
  40. $(CC) $(CFLAGS) -c -o $@ $<