2024-05-05 20:53:52 +02:00
|
|
|
.PHONY: run clean install all
|
2024-06-04 21:36:05 +02:00
|
|
|
.DELETE_ON_ERROR: $(BINDIR)/Getting_Started_with_GTK
|
2024-05-05 20:53:52 +02:00
|
|
|
.DEFAULT_GOAL: all
|
2024-04-20 11:17:01 +02:00
|
|
|
|
2024-06-04 21:36:05 +02:00
|
|
|
NTHREADS= $(shell nproc)
|
|
|
|
|
2024-04-22 18:40:30 +02:00
|
|
|
CC=gcc
|
2024-06-05 22:36:44 +02:00
|
|
|
CFLAGS=`pkg-config --cflags gtk4 gl glib-2.0 libxml-2.0`
|
|
|
|
LDFLAGS=`pkg-config --libs gtk4 gl glib-2.0 libxml-2.0` -lGL -lGLU -lm -lepoxy -lX11 -lGLEW
|
2024-04-20 11:17:01 +02:00
|
|
|
WARNINGS = -Wall
|
2024-06-04 21:36:05 +02:00
|
|
|
DEBUG = -ggdb -fno-omit-frame-pointer #-fdiagnostics-color=always -fsanitize=bounds -fstack-check
|
2024-05-05 20:53:52 +02:00
|
|
|
OPTIMIZE = -O3
|
2024-06-04 21:36:05 +02:00
|
|
|
|
|
|
|
BINDIR=bin
|
|
|
|
BUILDDIR=build
|
|
|
|
SRCDIR=src
|
2024-04-20 11:17:01 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
SOURCES = $(shell find $(SRCDIR) -type f -name "*.c")
|
|
|
|
OBJECTS = $(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES))
|
|
|
|
DEPENDENCIES = $(patsubst %.c,$(BUILDDIR)/%.d,$(SOURCES))
|
2024-04-20 11:17:01 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
all: $(BINDIR)/gem-graph-client
|
2024-04-20 11:17:01 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
-include /etc/os-release
|
2024-05-05 20:53:52 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
#
|
|
|
|
# Directories
|
|
|
|
#
|
|
|
|
$(BUILDDIR):
|
|
|
|
mkdir -p $@
|
2024-05-05 20:53:52 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
$(BINDIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
|
|
|
#
|
|
|
|
# Dependencies
|
|
|
|
#
|
|
|
|
-include $(DEPENDENCIES)
|
2024-05-05 20:53:52 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
$(BUILDDIR)/%.d: %.c Makefile | $(BUILDDIR)
|
|
|
|
mkdir -p $(shell dirname $@)
|
2024-05-05 20:53:52 +02:00
|
|
|
$(CC) $(CFLAGS) -MM -MT $(@:%.d=%.o) -MF $@ $<
|
2024-04-20 11:17:01 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
#
|
|
|
|
# Main program
|
|
|
|
#
|
|
|
|
$(BINDIR)/gem-graph-client: $(OBJECTS) | $(BINDIR)
|
|
|
|
$(CC) $(LDFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) $^ -o $@
|
|
|
|
|
|
|
|
#
|
|
|
|
# Objects
|
|
|
|
#
|
|
|
|
$(BUILDDIR)/%.o: %.c Makefile | $(BUILDDIR)
|
|
|
|
mkdir -p $(shell dirname $@)
|
|
|
|
$(CC) $(CFLAGS) $(WARNINGS) $(DEBUG) $(OPTIMIZE) -c $< -o $@
|
|
|
|
|
|
|
|
#
|
|
|
|
# Virtual recipes
|
|
|
|
#
|
2024-04-20 11:17:01 +02:00
|
|
|
install:
|
|
|
|
echo "Installing is not supported"
|
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
run: $(BINDIR)/gem-graph-client
|
|
|
|
$(BINDIR)/gem-graph-client
|
2024-04-26 19:40:19 +02:00
|
|
|
|
2024-05-05 20:53:52 +02:00
|
|
|
clean:
|
2024-06-29 17:05:13 +02:00
|
|
|
rm -rf $(BINDIR)
|
|
|
|
rm -rf $(BUILDDIR)
|
2024-04-27 16:16:21 +02:00
|
|
|
|
2024-04-26 19:40:19 +02:00
|
|
|
|
2024-06-29 17:05:13 +02:00
|
|
|
# More docs :
|
2024-04-26 19:40:19 +02:00
|
|
|
# https://www.gnu.org/software/make/manual/
|
2024-04-27 14:59:32 +02:00
|
|
|
# accessoirement : https://blog.stephane-robert.info/docs/makefile/ & /docs/task/
|
2024-04-20 11:17:01 +02:00
|
|
|
|