rntviewer/Makefile

62 lines
2 KiB
Makefile
Raw Normal View History

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