gem-graph-client/Makefile
Jean Sirmai 80b15346a5
WIP: memory leaks fsm/measures/tools fsm_tools_list_test() < OK
The function fsm_tools_list_test() calls:
- fsm_tools_list_insert()
- fsm_tools_list_view()
- fsm_tools_list_pop()
- fsm_tools_list_clear()

The status: SUMMARY: AddressSanitizer: 9488 byte(s) leaked in 340 allocation(s).
is unchanged before/after introduction of the files:
- fsm/measures/tools.c
- fsm/measures/data.c
and the execution of the function fsm_tools_list_test()
2025-01-20 11:15:17 +01:00

107 lines
2.4 KiB
Makefile

.PHONY: run clean install all docs man my # A phony target is not a file name
.DELETE_ON_ERROR: $(BINDIR)/Getting_Started_with_GTK
.DEFAULT_GOAL: all
CPUS ?= $(shell (nproc --all || sysctl -n hw.ncpu) 2>/dev/null || echo 1)
MAKEFLAGS += --jobs=$(CPUS)
CC=gcc
DOXYGEN=doxygen
MAKEINFO=makeinfo
CFLAGS=`pkg-config --cflags gtk4 epoxy glib-2.0 libxml-2.0`
LDFLAGS=`pkg-config --libs gtk4 epoxy glib-2.0 libxml-2.0` -lGL -lGLU -lm -lepoxy -lX11 -lGLEW
WARNINGS = -Wall
DEBUG = -ggdb -fno-omit-frame-pointer \
-fdiagnostics-color=always \
-fsanitize=address,undefined -fstack-protector-strong
# -fsanitize=leak # << même sortie console que: -fsanitize=address
# -fsanitize=address -fstack-protector-strong
# -fsanitize=memory
# -fuse-ld=gold
OPTIMIZE = -O3
BINDIR=bin
BUILDDIR=build
SRCDIR=src
DOCSDIR=docs
MANSRC=$(DOCSDIR)/rtfm/*.texi
MANDIR=$(DOCSDIR)/rtfm
SOURCES = $(shell find $(SRCDIR) -type f -name "*.c")
OBJECTS = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES))
DEPENDENCIES = $(patsubst %.c,$(BUILDDIR)/%.d,$(SOURCES))
all: $(BINDIR)/gem-graph-client
-include /etc/os-release
#
# Directories
#
$(BUILDDIR):
@mkdir -p $@
@echo " MKDIR $@"
$(BINDIR):
@mkdir -p $@
@echo " MKDIR $@"
#
# Dependencies
#
-include $(DEPENDENCIES)
$(BUILDDIR)/%.d: %.c Makefile | $(BUILDDIR)
@mkdir -p $(shell dirname $@)
@$(CC) $(CFLAGS) -MM -MT $(@:%.d=%.o) -MF $@ $<
@echo " DEP $@"
#
# Main program
#
$(BINDIR)/gem-graph-client: $(OBJECTS) | $(BINDIR)
@$(CC) $(LDFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) $^ -o $@
@echo " LD $@"
#
# Objects
#
$(BUILDDIR)/%.o: %.c Makefile | $(BUILDDIR)
@mkdir -p $(shell dirname $@)
@$(CC) $(CFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) -c $< -o $@
@echo " CC $@"
#
# Manual
#
$(MANDIR)/gem-graph.pdf: $(MANSRC)
@cd $(BUILDDIR) && $(MAKEINFO) --pdf ../$(MANSRC) -o ../$(MANDIR)/gem-graph.pdf
@echo " MAKEINFO $(MANSRC)"
#
# Virtual recipes
#
install:
@echo "Installing is not supported"
run: $(BINDIR)/gem-graph-client
$(BINDIR)/gem-graph-client
docs: $(SOURCES) $(DEPENDENCIES)
@$(DOXYGEN) $(DOCSDIR)/doxyfile
@echo " DOXYGEN $(DOCSDIR)/doxyfile"
man: $(MANDIR)/gem-graph.pdf
clean:
@rm -rf $(BINDIR)
@echo " RM $(BINDIR)"
@rm -rf $(BUILDDIR)
@echo " RM $(BUILDDIR)"
@rm -rf $(MANDIR)/gem-graph.pdf
@echo " RM $(MANDIR)/gem-graph.pdf"
# More docs :
# https://www.gnu.org/software/make/manual/
# accessoirement : https://blog.stephane-robert.info/docs/makefile/ & /docs/task/