Debian Codegraph @

Makefile

raw
1 ################################################################################
2 # GTK-NoCSD #
3 # Copyright (C) 2025 MorsMortium #
4 # #
5 # This program is free software: you can redistribute it and/or modify #
6 # it under the terms of the GNU General Public License as published by #
7 # the Free Software Foundation, either version 3 of the License, or #
8 # (at your option) any later version. #
9 # #
10 # This program is distributed in the hope that it will be useful, #
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
13 # GNU General Public License for more details. #
14 # #
15 # You should have received a copy of the GNU General Public License #
16 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
17 ################################################################################
18
19 ###########################
20 # * ARGUMENTS * #
21 ###########################
22
23 # Paths
24 PREFIX ?= /usr/local
25 LICENSEDIR ?= $(PREFIX)/share/licenses/gtk-nocsd
26 LIBDIR ?= $(PREFIX)/lib64
27 OPTDIR ?= /opt/gtk-nocsd
28 DOCDIR ?= $(PREFIX)/share/doc/gtk-nocsd
29
30 # Compilation
31 CC ?= cc
32 PKG_CONFIG ?= pkg-config
33 CFLAGS += `$(PKG_CONFIG) --cflags libadwaita-1 gobject-2.0 gio-2.0` -Wall -Wextra \
34 -Wconversion -Wstrict-prototypes
35 ifndef NOLDFLAGS
36 LDFLAGS += `$(PKG_CONFIG) --libs gobject-2.0 gio-2.0`
37 else
38 LDFLAGS =
39 endif
40
41 ###########################
42 # * TARGETS * #
43 ###########################
44 build: libgtk-nocsd.so.0
45
46 libgtk-nocsd.so.0: ./Source/GTK-NoCSD.c
47 $(CC) -fPIC -shared ./Source/GTK-NoCSD.c -o libgtk-nocsd.so.0 \
48 -Wl,-soname,libgtk-nocsd.so.0 \
49 -Wl,-e,GTKNoCSDMain $(CFLAGS) $(LDFLAGS)
50
51 clean:
52 rm -f ./libgtk-nocsd.so.0
53
54 install: build
55 @for dir in "$(LICENSEDIR)" "$(LIBDIR)"; do\
56 mkdir -p "$(DESTDIR)$$dir";\
57 done
58 install -m 644 LICENSE $(DESTDIR)$(LICENSEDIR)/LICENSE
59 install -Dm 755 libgtk-nocsd.so.0 $(DESTDIR)$(LIBDIR)/libgtk-nocsd.so.0
60 ln -s libgtk-nocsd.so.0 $(DESTDIR)$(LIBDIR)/libgtk-nocsd.so
61
62 ifndef NOOPT
63 mkdir -p "$(DESTDIR)$(OPTDIR)"
64 ln $(DESTDIR)$(LIBDIR)/libgtk-nocsd.so.0 \
65 $(DESTDIR)$(OPTDIR)/libgtk-nocsd.so
66 endif
67
68 ifndef NODOC
69 mkdir -p "$(DESTDIR)$(DOCDIR)/examples/profile.d"
70 install -m 644 Source/gtk-nocsd.sh \
71 $(DESTDIR)$(DOCDIR)/examples/profile.d/gtk-nocsd.sh
72 install -m 644 Source/gtk-nocsd.csh \
73 $(DESTDIR)$(DOCDIR)/examples/profile.d/gtk-nocsd.csh
74 endif
75
76 uninstall:
77 -rm -r $(DESTDIR)$(LICENSEDIR)
78 -rm -r $(DESTDIR)$(OPTDIR)
79 -rm -r $(DESTDIR)$(DOCDIR)
80 -rm $(DESTDIR)$(LIBDIR)/libgtk-nocsd.so.0
81 -rm $(DESTDIR)$(LIBDIR)/libgtk-nocsd.so
82
83 format:
84 uncrustify -c ./Uncrustify.cfg --replace ./Source/*.c
85
86 .PHONY: build uninstall format clean install