]> git.armaanb.net Git - chorizo.git/blob - Makefile
draft 8
[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 EXTENSIONS = extensions/we_adblock
4 PREFIX = /usr/local
5 bindir = $(DESTDIR)$(PREFIX)/bin
6 libdir = $(DESTDIR)$(PREFIX)/lib
7 datadir = $(DESTDIR)$(PREFIX)/share
8 mandir = $(DESTDIR)/$(PREFIX)/man
9
10 .PHONY: chorizo clean uninstall install extensions update-darkreader
11
12 all: chorizo
13
14 chorizo:
15         $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o chorizo *.c
16
17 format:
18         for i in *.c *.h; do clang-format $$i > tmp; mv tmp $$i; done
19
20 headers:
21         mv config.h tmp
22         rm chorizo.h
23         makeheaders -h *.[ch] > tmp2
24         mv tmp config.h
25         mv tmp2 chorizo.h
26
27 $(EXTENSIONS):
28         $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@.so -fPIC $@.c $(LIBS);
29
30 extensions: $(EXTENSIONS)
31
32 install: all
33         mkdir -p $(bindir) \
34                 $(mandir)/man1 \
35                 $(libdir)/chorizo/web-extensions \
36                 $(datadir)/chorizo/user-scripts
37
38         cp chorizo $(bindir)/
39
40         cp chorizo.1 $(mandir)/man1/
41         makewhatis /usr/local/man
42
43         cp -r extensions/*.so $(libdir)/chorizo/web-extensions/
44         cp -r user-scripts/* $(datadir)/chorizo/user-scripts/
45
46 uninstall:
47         rm -rf $(bindir)/chorizo \
48                 $(libdir)/chorizo \
49                 $(mandir)/man1/chorizo* \
50                 $(datadir)/chorizo
51
52 reinstall: uninstall install
53
54 update-darkreader:
55         curl -L "https://cdn.jsdelivr.net/npm/darkreader/darkreader.min.js" \
56                 -o user-scripts/darkreader.js
57         echo >> user-scripts/darkreader.js
58         echo 'DarkReader.enable({brightness:100,contrast:100,sepia:0});' \
59                 >> user-scripts/darkreader.js
60
61 clean:
62         rm -fv chorizo extensions/*.so