51 lines
1.7 KiB
Makefile
51 lines
1.7 KiB
Makefile
ifeq ($(shell which root-config),)
|
|
ROOT = $(HOME)/root_build/debug
|
|
$(info Cannot find root-config: guessing the root is $(ROOT). Please source thisroot.sh)
|
|
ROOTINCDIR = $(ROOT)/include
|
|
ROOTLIBDIR = $(ROOT)/lib
|
|
else
|
|
ROOTINCDIR = $(shell root-config --incdir)
|
|
ROOTLIBDIR = $(shell root-config --libdir)
|
|
endif
|
|
|
|
CFLAGS = -Wall -Wextra -pedantic
|
|
INC = -Ithird_party -Ithird_party/imgui
|
|
LIBS = -lglfw
|
|
|
|
ROOTFLAGS = -std=c++17 -m64 -I$(ROOTINCDIR)
|
|
ROOTLIBS = -L$(ROOTLIBDIR) -lCore -lRIO -lROOTNTuple -lxxhash -pthread
|
|
|
|
ifeq ($(shell which mold),)
|
|
MOLD =
|
|
else
|
|
MOLD = mold -run
|
|
endif
|
|
ROOT_IFACE = build/RMicroFileReader.o
|
|
ROOT_IFACE_DBG = $(ROOT_IFACE)
|
|
|
|
.PHONY: all clean
|
|
all: build/imgui.o $(ROOT_IFACE) noasan
|
|
|
|
clean:
|
|
rm build/*.o rntviewer $(ROOT_IFACE)
|
|
|
|
build/imgui.o: src/imgui_inc.cpp third_party/imgui/imgui.h
|
|
$(CXX) -O3 -fPIC -c -Ithird_party/imgui $< -o $@
|
|
|
|
$(ROOT_IFACE): src/root/RMicroFileReader.cxx
|
|
$(CXX) -O3 -fPIC -c $(ROOTFLAGS) $< -o $@
|
|
|
|
# debug build
|
|
d: $(ROOT_IFACE_DBG) build/imgui.o
|
|
$(MOLD) $(CXX) -DDEBUG -g -O0 -DENABLE_ASAN $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o -lasan $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)
|
|
|
|
# release build
|
|
r: $(ROOT_IFACE) build/imgui.o
|
|
$(MOLD) $(CXX) -O2 -DNDEBUG $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o $(ROOT_IFACE) $(LIBS) $(ROOTLIBS)
|
|
|
|
# sanitizers
|
|
asan: $(ROOT_IFACE_DBG) build/imgui.o
|
|
$(MOLD) $(CXX) -DDEBUG -g -O0 $(CFLAGS) -fsanitize=address $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)
|
|
|
|
ubsan: $(ROOT_IFACE_DBG) build/imgui.o
|
|
$(MOLD) $(CXX) -DDEBUG -g -O0 $(CFLAGS) -fsanitize=undefined $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)
|