Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # defaults
  2. ifndef DEBUG
  3. CXXFLAGS ?= -O3 -march=native -fomit-frame-pointer -pipe
  4. else
  5. CXXFLAGS += -ggdb3 -DDEBUG
  6. endif
  7. #LDFLAGS ?= -Wl,-O1
  8. LDFLAGS ?= -Wl,-O1 -Wl,--as-needed
  9. STRIP ?= strip --strip-unneeded -R .comment
  10. # root-dependant stuff
  11. ROOTCFLAGS ?= $(shell root-config --cflags)
  12. CXXFLAGS += -std=c++11 -Wall -pipe -D_FILE_OFFSET_BITS=64 $(ROOTCFLAGS) -fvisibility-inlines-hidden
  13. ROOTLIBS = $(shell root-config --libs)
  14. DEPFLAGS = -isystem $(shell root-config --incdir)
  15. SRCS = htree.cpp tof.cpp
  16. OBJS = $(SRCS:.cpp=.o)
  17. DEPS = $(SRCS:.cpp=.d)
  18. ##### RULES #####
  19. .PHONY: all clean deps distclean tags
  20. all: htree
  21. deps: $(DEPS)
  22. %.d: %.cpp
  23. $(CXX) $(DEPFLAGS) $(CXXFLAGS) -MM -MG $< > $@
  24. ### Binaries rules
  25. htree: $(DEPS) $(OBJS) Makefile
  26. $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(ROOTLIBS) -o $@
  27. ifndef DEBUG
  28. $(STRIP) $@
  29. endif
  30. # misc and cleanup
  31. tags:
  32. ctags $(SRCS)
  33. clean:
  34. rm -f $(OBJS) $(DEPS)
  35. distclean: clean
  36. rm -f $(BINS) tags
  37. # on distclean per-file deps will be removed anyway
  38. ifneq ($(MAKECMDGOALS),clean)
  39. ifneq ($(MAKECMDGOALS),distclean)
  40. -include $(DEPS)
  41. endif
  42. endif