summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2021-09-08 10:52:05 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2021-09-08 10:52:05 +0200
commite418543550a42878bcb04fa1e3f4b3f4451d295b (patch)
treebe3d4048364942a925e8630f91b48b2fc5af65e7 /Makefile
parentcode rewriting (diff)
downloaddiscord.c-e418543550a42878bcb04fa1e3f4b3f4451d295b.tar
discord.c-e418543550a42878bcb04fa1e3f4b3f4451d295b.tar.gz
discord.c-e418543550a42878bcb04fa1e3f4b3f4451d295b.tar.bz2
discord.c-e418543550a42878bcb04fa1e3f4b3f4451d295b.tar.lz
discord.c-e418543550a42878bcb04fa1e3f4b3f4451d295b.tar.xz
discord.c-e418543550a42878bcb04fa1e3f4b3f4451d295b.tar.zst
discord.c-e418543550a42878bcb04fa1e3f4b3f4451d295b.zip
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 22 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 3ac796f..403fb2f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,11 @@
DESTDIR=/
-CFLAGS += -Wextra -Wall -pedantic -g -Itmp -Isrc -I. -odiscord.c -Wno-unused-parameter -export-dynamic -rdynamic -finput-charset=UTF-8 -fextended-identifiers
-CFLAGS += $(shell pkg-config --libs --cflags libwebsockets) $(shell pkg-config --libs --cflags gtk+-3.0) $(shell pkg-config --libs --cflags gmodule-export-2.0)
+SRCFILE=src/main.c
+CFLAGS += -Wextra -Wall -pedantic -g -Og -Itmp -Isrc -I. -odiscord.c -Wno-unused-parameter -rdynamic -finput-charset=UTF-8 -fextended-identifiers
+LIBS += -lm
+CFLAGS += $(shell pkg-config --cflags libwebsockets) $(shell pkg-config --cflags gtk+-3.0) $(shell pkg-config --cflags gmodule-export-2.0)
+LIBS += $(shell pkg-config --libs libwebsockets) $(shell pkg-config --libs gtk+-3.0) $(shell pkg-config --libs gmodule-export-2.0)
CC=cc
-
+VGARGS += --leak-check=full --track-origins=yes --verbose --log-file=valgrind-out.txt --suppressions=/usr/share/glib-2.0/valgrind/glib.supp --suppressions=tmp/gtk.supp --suppressions=/usr/lib/i386-linux-gnu/valgrind/default.supp --suppressions=tmp/gnome.supp --show-leak-kinds=definite --suppressions=misc/misc.supp --suppressions=/usr/share/gtk-3.0/valgrind/gtk.supp --leak-resolution=low
# notparallel ker morajo biti ukazi izvedeni po vrsti, mkdir se mora zgoditi pred xxd recimo.
.NOTPARALLEL:
@@ -10,7 +13,7 @@ default:
mkdir tmp -p
xxd -i < src/ui.glade > tmp/ui.xxd
echo ', 0' >> tmp/ui.xxd
- $(CC) $(CFLAGS) src/main.c $(LIBS)
+ $(CC) $(CFLAGS) $(SRCFILE) $(LIBS)
install:
mkdir -p $(DESTDIR)/usr/bin/
@@ -25,5 +28,19 @@ clean:
prepare:
sudo apt install build-essential libwebsockets-dev libcjson-dev libsoundio-dev libgtk-3-dev xxd -y
+# developing is to be done on i386. for example the default suppression file is hardcoded for i386 here:
+# developing is to be done on bullseye. we download gtk.supp even though debian ships it, because that's how we "get rid of" more leaks.
+
+valgrind-prepare:
+ mkdir -p tmp
+ -[ ! -f tmp/gtk.supp ] && wget -c -Otmp/gtk.supp https://gitlab.gnome.org/GNOME/gtk/raw/master/gtk.supp
+ -[ ! -d tmp/GNOME.supp ] && bash -c "cd tmp && git clone https://github.com/GreenBeard/GNOME.supp && cd GNOME.supp && make && cd build && cat * > ../../gnome.supp"
+
valgrind:
- valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt --suppressions=misc/openssl.supp ./discord.c
+ -[ ! -f tmp/gend.supp ] && bash -c "echo '' > tmp/gend.supp"
+ G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind $(VGARGS) --suppressions=tmp/gend.supp ./discord.c
+
+gensupp:
+ cc misc/valgrind-supp-extractor.c -otmp/vse
+ G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind $(VGARGS) --gen-suppressions=all ./discord.c
+ tmp/vse < valgrind-out.txt > tmp/gend.supp