]> git.armaanb.net Git - chorizo.git/blob - Makefile
draft 6
[chorizo.git] / Makefile
1 CFLAGS += -Wno-unused-parameter -Wunknown-warning-option -D_XOPEN_SOURCE="700"
2 LIBS = `pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0`
3 PREFIX = /usr/local
4 bindir = $(DESTDIR)$(PREFIX)/bin
5 libdir = $(DESTDIR)$(PREFIX)/lib
6 datadir = $(DESTDIR)$(PREFIX)/share
7 mandir = $(DESTDIR)/$(PREFIX)/man
8
9 .PHONY: chorizo clean uninstall install extensions update-darkreader
10
11 all: chorizo
12
13 chorizo:
14         $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o chorizo *.c
15
16 format:
17         for i in *.c *.h; do clang-format $$i > tmp; mv tmp $$i; done
18
19 extensions:
20         for i in extensions/*.c; do \
21                 outp=$$(echo "$$i" | sed 's/\$\.c/.so/g'); \
22                 $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $$outp -fPIC $$i $(LIBS); \
23         done
24
25 install: all
26         mkdir -p $(bindir) \
27                 $(mandir)/man1 \
28                 $(libdir)/chorizo/web-extensions \
29                 $(datadir)/chorizo/user-scripts
30
31         cp chorizo $(bindir)/
32
33         cp chorizo.1 $(mandir)/man1/
34         makewhatis /usr/local/man
35
36         cp -r extensions/*.so $(libdir)/chorizo/web-extensions/
37         cp -r user-scripts/* $(datadir)/chorizo/user-scripts/
38
39 uninstall:
40         rm -rf $(bindir)/chorizo \
41                 $(libdir)/chorizo \
42                 $(mandir)/man1/chorizo* \
43                 $(datadir)/chorizo
44
45 reinstall: uninstall install
46
47 update-darkreader:
48         curl -L "https://cdn.jsdelivr.net/npm/darkreader/darkreader.min.js" \
49                 -o user-scripts/darkreader.js
50         echo >> user-scripts/darkreader.js
51         echo 'DarkReader.enable({brightness:100,contrast:100,sepia:0});' \
52                 >> user-scripts/darkreader.js
53
54 clean:
55         rm -fv chorizo extensions/*.so