]> git.armaanb.net Git - chorizo.git/blob - Makefile
7d74b4a887835f7601910288dbc993cbd72da197
[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 headers:
20         mv config.h tmp
21         rm chorizo.h
22         makeheaders -h *.[ch] > tmp2
23         mv tmp config.h
24         mv tmp2 chorizo.h
25
26 extensions:
27         for i in extensions/*.c; do \
28                 outp=$$(echo "$$i" | sed 's/\$\.c/.so/g'); \
29                 $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $$outp -fPIC $$i $(LIBS); \
30         done
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