1
|
# This file is part of Haketilo
|
2
|
#
|
3
|
# Copyright (C) 2021 jahoti
|
4
|
# Copyright (C) 2021, 2022 Wojtek Kosior
|
5
|
#
|
6
|
# This program is free software: you can redistribute it and/or modify
|
7
|
# it under the terms of the CC0 1.0 Universal License as published by
|
8
|
# the Creative Commons Corporation.
|
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
|
# CC0 1.0 Universal License for more details.
|
14
|
|
15
|
SHELL = /bin/sh
|
16
|
VPATH = <<VPATH>>
|
17
|
|
18
|
version = <<VERSION>>
|
19
|
extension_files = background/ common/ content/ html/ licenses/ \
|
20
|
icons/ copyright default_settings.json manifest.json
|
21
|
|
22
|
|
23
|
metafiles = build.sh configure Makefile.in compute_scripts.awk README.txt \
|
24
|
re-generate_icons.sh shell_utils.sh upload_amo.sh write_makefile.sh
|
25
|
|
26
|
# Configuration gets included here by write_makefile.sh
|
27
|
|
28
|
# The default target: placed up here
|
29
|
default: $(default_target)
|
30
|
|
31
|
# haketilo-$(version).tar is not actually a phony target but it is too hard to
|
32
|
# track all the files that might require remaking it, so we instead re-run it
|
33
|
# every time.
|
34
|
.PHONY: mozilla install-mozilla chromium install-chromium \
|
35
|
all all-unpacked default unpacked \
|
36
|
install install-html install-dvi install-pdf install-ps uninstall \
|
37
|
install-strip clean distclean mostlyclean maintainer-clean TAGS info \
|
38
|
dvi html pdf ps dist check installcheck installdirs \
|
39
|
test-prepare test test-environment haketilo-$(version).tar
|
40
|
|
41
|
# core files
|
42
|
icons/haketilo16.png: icons/haketilo.svg
|
43
|
cd "$(srcdir)" && ./re-generate_icons.sh
|
44
|
# Use haketilo16.png as an "index" for all the icon PNGs
|
45
|
|
46
|
# browser-specific targets
|
47
|
all: mozilla chromium
|
48
|
mozilla: mozilla-build.zip
|
49
|
chromium: chromium-build.zip
|
50
|
|
51
|
unpacked: $(default_target)-unpacked Makefile
|
52
|
all-unpacked: mozilla-unpacked chromium-unpacked
|
53
|
%-unpacked: $(extension_files) icons/haketilo16.png
|
54
|
"$(srcdir)/build.sh" $* $(srcdir) $(UPDATE_URL)
|
55
|
|
56
|
install install-strip: $(default_target)-unpacked
|
57
|
cp -R $(default_target)-unpacked \
|
58
|
"$(DESTDIR)/{6fe13369-88e9-440f-b837-5012fb3bedec}"
|
59
|
|
60
|
uninstall:
|
61
|
rm -r "$(DESTDIR)/{6fe13369-88e9-440f-b837-5012fb3bedec}"
|
62
|
|
63
|
%-build.zip: %-unpacked Makefile
|
64
|
cd $< && zip -q -r ../$@ *
|
65
|
|
66
|
certs/:
|
67
|
mkdir $@
|
68
|
|
69
|
certs/%.key: | certs/
|
70
|
openssl genrsa -out $@ 2048
|
71
|
|
72
|
certs/rootCA.pem: certs/rootCA.key
|
73
|
openssl req -x509 -new -nodes -key $< -days 1024 -out $@ \
|
74
|
-subj "/CN=Haketilo Test"
|
75
|
|
76
|
pytest.ini: pytest.ini.in
|
77
|
sed "s|<<SRCDIR>>|$(srcdir)|" <$< > $@
|
78
|
|
79
|
test-prepare: certs/rootCA.pem certs/site.key $(default_target)-build.zip \
|
80
|
pytest.ini
|
81
|
|
82
|
check: test
|
83
|
test: test-prepare
|
84
|
PYTHONPYCACHEPREFIX="$$(pwd)/test__pycache__" MOZ_HEADLESS=whatever \
|
85
|
"$(PYTHON)" -m pytest
|
86
|
|
87
|
test-environment: certs/rootCA.pem certs/site.key
|
88
|
unset MOZ_HEADLESS; PYTHONPATH="$$PYTHONPATH:$(srcdir)/test" \
|
89
|
"$(PYTHON)" -m haketilo_test
|
90
|
|
91
|
test-environment-with-haketilo: certs/rootCA.pem certs/site.key \
|
92
|
$(default_target)-build.zip
|
93
|
unset MOZ_HEADLESS; PYTHONPATH="$$PYTHONPATH:$(srcdir)/test" \
|
94
|
"$(PYTHON)" -m haketilo_test --load-haketilo
|
95
|
|
96
|
# helper targets
|
97
|
clean mostlyclean:
|
98
|
rm -rf mozilla-unpacked chromium-unpacked haketilo-[1-9]*
|
99
|
rm -f mozilla-build.zip chromium-build.zip exports_init.js
|
100
|
rm -rf pytest.ini certs injected_scripts geckodriver.log
|
101
|
rm -rf certs/ test__pycache__/ .pytest_cache/
|
102
|
rm -f *.tar *.tar.gz
|
103
|
|
104
|
distclean: clean
|
105
|
rm -f Makefile config.status record.conf
|
106
|
|
107
|
maintainer-clean: distclean
|
108
|
@echo 'This command is intended for maintainers to use; it'
|
109
|
@echo 'deletes files that may need special tools to rebuild.'
|
110
|
rm -f "$(srcdir)"/icons/*.png "$(srcdir)"/FILES.txt
|
111
|
|
112
|
# To make the next rule happy in case we're building from tarball.
|
113
|
$(srcdir)/.git:
|
114
|
|
115
|
$(srcdir)/FILES.txt: $(srcdir)/.git
|
116
|
if [ -e "$(srcdir)/.git" ]; then \
|
117
|
git -C "$(srcdir)" ls-files --cached --recurse-submodules | \
|
118
|
grep -v gitmodules > $@; \
|
119
|
printf 'FILES.txt\n' >> $@; \
|
120
|
fi
|
121
|
|
122
|
haketilo-$(version).tar: FILES.txt
|
123
|
HERE="$$(pwd)"; \
|
124
|
cd "$(srcdir)"; \
|
125
|
tar -caf "$$HERE/$@" --transform='s_^_haketilo-$(version)/_' \
|
126
|
$$(cat FILES.txt)
|
127
|
|
128
|
haketilo-$(version).tar.gz: haketilo-$(version).tar
|
129
|
gzip < haketilo-$(version).tar > haketilo-$(version).tar.gz
|
130
|
|
131
|
dist: haketilo-$(version).tar.gz
|
132
|
|
133
|
# Files for constructing the makefile
|
134
|
Makefile: config.status Makefile.in record.conf
|
135
|
./config.status
|
136
|
|
137
|
config.status: write_makefile.sh
|
138
|
cp "$(srcdir)"/write_makefile.sh config.status
|
139
|
|
140
|
# Unused GNU-specified targets
|
141
|
install-html:
|
142
|
install-dvi:
|
143
|
install-pdf:
|
144
|
install-ps:
|
145
|
TAGS:
|
146
|
info:
|
147
|
dvi:
|
148
|
html:
|
149
|
pdf:
|
150
|
ps:
|
151
|
installcheck:
|
152
|
installdirs:
|