summaryrefslogtreecommitdiff
path: root/Makefile
blob: 9c3e1bb492c349ccf5988592ac5ba6818477e989 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.POSIX:

_CFLAGS = $(CFLAGS) -Wall -Wextra -Wno-unused-parameter -O3
__NAME__ = lariza
__NAME_UPPERCASE__ = LARIZA

INSTALL = ./tools/install.sh
INSTALL_PROGRAM = $(INSTALL) -Dm 755
INSTALL_DATA = $(INSTALL) -Dm 644

PREFIX = /usr/local
EXEC_PREFIX = $(PREFIX)
BINDIR = $(EXEC_PREFIX)/bin
LIBDIR = $(EXEC_PREFIX)/lib
DATAROOTDIR = $(PREFIX)/share
MANDIR = $(DATAROOTDIR)/man
MAN1DIR = $(MANDIR)/man1
DATADIR = $(PREFIX)/share


all: $(__NAME__) we_adblock.so

-include browser.c.d
-include we_adblock.c.d

$(__NAME__): browser.c
	$(CC) $(_CFLAGS) $(LDFLAGS) \
		-D__NAME__=\"$(__NAME__)\" \
		-D__NAME_UPPERCASE__=\"$(__NAME_UPPERCASE__)\" \
		-MD -MF browser.c.d \
		-o $@ browser.c \
		`pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0`

we_adblock.so: we_adblock.c
	$(CC) $(_CFLAGS) $(LDFLAGS) \
		-D__NAME__=\"$(__NAME__)\" \
		-D__NAME_UPPERCASE__=\"$(__NAME_UPPERCASE__)\" \
		-MD -MF we_adblock.c.d \
		-shared -o $@ -fPIC we_adblock.c \
		`pkg-config --cflags --libs glib-2.0 webkit2gtk-4.0`

install: all
	$(INSTALL_PROGRAM) $(__NAME__) $(DESTDIR)$(BINDIR)/$(__NAME__)
	$(INSTALL_DATA) man1/$(__NAME__).1 $(DESTDIR)$(MAN1DIR)/$(__NAME__).1
	$(INSTALL_DATA) man1/$(__NAME__).usage.1 \
		$(DESTDIR)$(MAN1DIR)/$(__NAME__).usage.1
	$(INSTALL_PROGRAM) we_adblock.so \
		$(DESTDIR)$(LIBDIR)/$(__NAME__)/web_extensions/we_adblock.so
	$(INSTALL_DATA) user-scripts/hints.js \
		$(DESTDIR)$(DATADIR)/$(__NAME__)/user-scripts/hints.js

uninstall:
	rm -f $(DESTDIR)$(BINDIR)/$(__NAME__) \
		  $(DESTDIR)$(MAN1DIR)/$(__NAME__).1 \
		  $(DESTDIR)$(MAN1DIR)/$(__NAME__).usage.1
	rm -rf $(DESTDIR)$(LIBDIR)/$(__NAME__) \
		   $(DESTDIR)$(DATADIR)/$(__NAME__)

clean:
	rm -f $(__NAME__) we_adblock.so

allclean: clean
	rm -f browser.c.d we_adblock.c.d

.PHONY: all allclean clean install uninstall