Makefile 794 B

123456789101112131415161718192021222324252627282930313233343536
  1. CXXFLAGS = -O2 -g
  2. CFLAGS = -O2 -g
  3. OS := $(shell uname -s)
  4. IS_MINGW := $(shell echo $(OS) | grep -i MINGW)
  5. ifdef IS_MINGW
  6. LIBS = -lboost_filesystem-mt.dll
  7. else
  8. LIBS = -lboost_filesystem
  9. endif
  10. OBJS = $(patsubst %.c, %.o, $(wildcard *.c)) \
  11. $(patsubst %.cc, %.o, $(wildcard *.cc))
  12. C_DEPS = $(patsubst %.c, %.dep, $(wildcard *.c))
  13. CXX_DEPS = $(patsubst %.cc, %.depxx, $(wildcard *.cc))
  14. tx01_data : $(OBJS)
  15. echo $(IS_MINGW)
  16. $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
  17. sinclude $(DEPS)
  18. %.dep : %.c
  19. $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
  20. sed 's,\($*\)\.o[ :]*,\1.o $@:.g' < $@.$$$$ > $@; \
  21. $(RM) $@.$$$$
  22. %.depxx : %.cc
  23. $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
  24. sed 's,\($*\)\.o[ :]*,\1.o $@:.g' < $@.$$$$ > $@; \
  25. $(RM) $@.$$$$
  26. .PHONY : clean
  27. clean:
  28. $(RM) tx01_data $(OBJS) $(C_DEPS) $(CXX_DEPS)