rntviewer/Makefile

52 lines
1.7 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)
ROOTLIBS = -L$(ROOTLIBDIR) -lCore -lRIO -lROOTNTuple -lxxhash -pthread
ifeq ($(shell which mold),)
MOLD =
else
MOLD = mold -run
endif
2024-07-12 09:58:55 +00:00
ROOT_IFACE = build/RMicroFileReader.o
ROOT_IFACE_DBG = $(ROOT_IFACE)
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-07-12 07:53:01 +00:00
rm build/*.o rntviewer $(ROOT_IFACE)
2024-07-11 14:49:18 +00:00
build/imgui.o: src/imgui_inc.cpp third_party/imgui/imgui.h
2024-07-10 17:38:16 +00:00
$(CXX) -O3 -fPIC -c -Ithird_party/imgui $< -o $@
2024-07-11 14:29:44 +00:00
2024-07-12 09:58:55 +00:00
$(ROOT_IFACE): src/root/RMicroFileReader.cxx
$(CXX) -O3 -fPIC -c $(ROOTFLAGS) $< -o $@
2024-07-12 07:53:01 +00:00
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-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)