|
@@ -0,0 +1,51 @@
|
|
|
+# defaults
|
|
|
+ifndef DEBUG
|
|
|
+CXXFLAGS ?= -O3 -march=native -fomit-frame-pointer -pipe -DDEBUG
|
|
|
+else
|
|
|
+CXXFLAGS += -ggdb3
|
|
|
+endif
|
|
|
+#LDFLAGS ?= -Wl,-O1
|
|
|
+LDFLAGS ?= -Wl,-O1 -Wl,--as-needed
|
|
|
+STRIP ?= strip --strip-unneeded -R .comment
|
|
|
+
|
|
|
+# root-dependant stuff
|
|
|
+ROOTCFLAGS ?= $(shell root-config --cflags)
|
|
|
+CXXFLAGS += -std=c++11 -Wall -pipe -D_FILE_OFFSET_BITS=64 $(ROOTCFLAGS) -fvisibility-inlines-hidden
|
|
|
+ROOTLIBS = $(shell root-config --libs)
|
|
|
+DEPFLAGS = -isystem $(shell root-config --incdir)
|
|
|
+
|
|
|
+SRCS = htree.cpp tof.cpp
|
|
|
+OBJS = $(SRCS:.cpp=.o)
|
|
|
+DEPS = $(SRCS:.cpp=.d)
|
|
|
+
|
|
|
+##### RULES #####
|
|
|
+.PHONY: all clean deps distclean tags
|
|
|
+
|
|
|
+all: htree
|
|
|
+
|
|
|
+deps: $(DEPS)
|
|
|
+
|
|
|
+%.d: %.cpp
|
|
|
+ $(CXX) $(DEPFLAGS) $(CXXFLAGS) -MM -MG $< > $@
|
|
|
+
|
|
|
+### Binaries rules
|
|
|
+htree: $(DEPS) $(OBJS) Makefile
|
|
|
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(ROOTLIBS) -o $@
|
|
|
+ifndef DEBUG
|
|
|
+ $(STRIP) $@
|
|
|
+endif
|
|
|
+
|
|
|
+# misc and cleanup
|
|
|
+tags:
|
|
|
+ ctags $(SRCS)
|
|
|
+clean:
|
|
|
+ rm -f $(OBJS) $(DEPS)
|
|
|
+distclean: clean
|
|
|
+ rm -f $(BINS) tags
|
|
|
+
|
|
|
+# on distclean per-file deps will be removed anyway
|
|
|
+ifneq ($(MAKECMDGOALS),clean)
|
|
|
+ifneq ($(MAKECMDGOALS),distclean)
|
|
|
+-include $(DEPS)
|
|
|
+endif
|
|
|
+endif
|