rntviewer/Makefile

72 lines
2.5 KiB
Makefile
Raw Normal View History

2024-07-16 12:55:17 +00:00
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
2024-07-10 17:38:16 +00:00
CFLAGS = -Wall -Wextra -pedantic
INC = -Ithird_party -Ithird_party/imgui
2024-07-10 19:52:48 +00:00
LIBS = -lglfw
2024-07-16 12:55:17 +00:00
ROOTFLAGS = -std=c++17 -m64 -I$(ROOTINCDIR)
2024-07-16 13:00:09 +00:00
ROOTLIBS = -L$(ROOTLIBDIR) -lCore -lRIO -lROOTNTuple -lxxhash -pthread -Wl,-rpath,$(ROOTLIBDIR)
2024-07-16 12:55:17 +00:00
2024-08-09 11:43:57 +00:00
IMGUI_FLAGS = -Ithird_party -Ithird_party/imgui
2024-07-16 12:55:17 +00:00
ifeq ($(shell which mold),)
MOLD =
else
MOLD = mold -run
endif
2024-07-12 09:58:55 +00:00
ROOT_IFACE = build/RMicroFileReader.o
2024-07-23 08:41:55 +00:00
ROOT_IFACE_DBG = $(ROOT_IFACE).dbg
2024-07-10 15:04:11 +00:00
2024-07-11 14:49:18 +00:00
.PHONY: all clean
2024-07-16 12:58:54 +00:00
all: build/imgui.o $(ROOT_IFACE) ubsan
2024-07-10 17:38:16 +00:00
2024-07-11 14:49:18 +00:00
clean:
2024-08-09 11:43:57 +00:00
rm -f build/*.o rntviewer $(ROOT_IFACE) $(ROOT_IFACE_DBG)
2024-07-11 14:49:18 +00:00
build/imgui.o: src/imgui_inc.cpp
@mkdir -p $(@D)/build
2024-08-09 11:43:57 +00:00
$(CXX) -O3 -fPIC -c $(IMGUI_FLAGS) $< -o $@
2024-07-11 14:29:44 +00:00
2024-07-12 09:58:55 +00:00
$(ROOT_IFACE): src/root/RMicroFileReader.cxx
2024-08-21 11:09:12 +00:00
@mkdir -p $(@D)/build
2024-07-12 09:58:55 +00:00
$(CXX) -O3 -fPIC -c $(ROOTFLAGS) $< -o $@
2024-07-12 07:53:01 +00:00
2024-07-23 08:41:55 +00:00
$(ROOT_IFACE_DBG): src/root/RMicroFileReader.cxx
2024-08-21 11:09:12 +00:00
@mkdir -p $(@D)/build
2024-07-23 08:41:55 +00:00
$(CXX) -O0 -DDEBUG -g -fPIC -c $(ROOTFLAGS) $< -o $@
2024-07-16 12:55:17 +00:00
# debug build
d: $(ROOT_IFACE_DBG) build/imgui.o
2024-07-12 09:58:55 +00:00
$(MOLD) $(CXX) -DDEBUG -g -O0 -DENABLE_ASAN $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o -lasan $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)
2024-07-16 12:55:17 +00:00
# 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)
2024-08-09 11:43:57 +00:00
# debug-release build
dr: $(ROOT_IFACE_DBG) build/imgui.o
$(MOLD) $(CXX) -g -O2 $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)
2024-07-12 07:53:01 +00:00
2024-07-16 12:55:17 +00:00
# sanitizers
2024-07-12 16:29:35 +00:00
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)
2024-07-16 12:55:17 +00:00
ubsan: $(ROOT_IFACE_DBG) build/imgui.o
2024-07-12 09:58:55 +00:00
$(MOLD) $(CXX) -DDEBUG -g -O0 $(CFLAGS) -fsanitize=undefined $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp build/imgui.o $(ROOT_IFACE_DBG) $(LIBS) $(ROOTLIBS)
2024-07-25 16:23:58 +00:00
# no gfx debug build
nogfx_d: $(ROOT_IFACE_DBG)
$(MOLD) $(CXX) -DDEBUG -g -O0 -DRNT_NO_GFX -DENABLE_ASAN $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp -lasan $(ROOT_IFACE_DBG) $(ROOTLIBS)
# no gfx release build
nogfx_r: $(ROOT_IFACE)
$(MOLD) $(CXX) -O2 -DRNT_NO_GFX -DNDEBUG $(CFLAGS) $(INC) $(ROOTFLAGS) -o rntviewer src/rntviewer.cpp $(ROOT_IFACE) $(ROOTLIBS)