-CFLAGS += -Wall -Wextra -Wno-unused-parameter -O3
-
+CFLAGS += -Wno-unused-parameter -Wunknown-warning-option -D_XOPEN_SOURCE="700"
+LIBS = `pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0`
+EXTENSIONS = extensions/we_adblock
PREFIX = /usr/local
bindir = $(DESTDIR)$(PREFIX)/bin
libdir = $(DESTDIR)$(PREFIX)/lib
datadir = $(DESTDIR)$(PREFIX)/share
-mandir = $(datadir)/man
-docdir = $(datadir)/doc
-
-.PHONY: man clean uninstall install extensions
+mandir = $(DESTDIR)/$(PREFIX)/man
-all: man chorizo extensions darkreader
+.PHONY: chorizo clean uninstall install extensions update-darkreader
-man:
- for i in man/*.scd; do \
- printf "SCDOC\t%s\n" $$i; \
- scdoc < $$i > $$(echo "$$i" | rev | cut -f 2- -d '.' | rev); \
- done
+all: chorizo
chorizo:
- $(CC) $(CFLAGS) $(LDFLAGS) \
- -D__NAME__=\"chorizo\" \
- -D__NAME_UPPERCASE__=\"CHORIZO\" \
- -DVERSION=\"v1.0.0\" \
- -o chorizo src/*.c \
- `pkg-config --cflags --libs gtk+-3.0 glib-2.0 webkit2gtk-4.0`
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) -o chorizo *.c
+
+format:
+ for i in *.c *.h; do clang-format $$i > tmp; mv tmp $$i; done
+
+headers:
+ mv config.h tmp
+ rm chorizo.h
+ makeheaders -h *.[ch] > tmp2
+ mv tmp config.h
+ mv tmp2 chorizo.h
-extensions:
- for i in extensions/*.c; do \
- outp=$$(echo "$$i" | sed 's/\$\.c/.so/g'); \
- $(CC) $(CFLAGS) $(LDFLAGS) \
- -D__NAME__=\"chorizo\" \
- -D__NAME_UPPERCASE__=\"CHORIZO\" \
- -shared -o $$outp -fPIC $$i \
- `pkg-config --cflags --libs glib-2.0 webkit2gtk-4.0`; \
- done
+$(EXTENSIONS):
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@.so -fPIC $@.c $(LIBS);
+
+extensions: $(EXTENSIONS)
install: all
mkdir -p $(bindir) \
$(mandir)/man1 \
- $(mandir)/man5 \
$(libdir)/chorizo/web-extensions \
- $(datadir)/chorizo/user-scripts \
- $(datadir)/applications \
- $(docdir)/chorizo
+ $(datadir)/chorizo/user-scripts
cp chorizo $(bindir)/
- cp man/*.1 $(mandir)/man1/
- cp man/*.5 $(mandir)/man5/
- cp chorizo.ini $(docdir)/chorizo/
- cp chorizo.desktop $(datadir)/applications/
+
+ cp chorizo.1 $(mandir)/man1/
+ makewhatis /usr/local/man
+
cp -r extensions/*.so $(libdir)/chorizo/web-extensions/
cp -r user-scripts/* $(datadir)/chorizo/user-scripts/
rm -rf $(bindir)/chorizo \
$(libdir)/chorizo \
$(mandir)/man1/chorizo* \
- $(mandir)/man5/chorizo* \
- $(datadir)/chorizo \
- $(datadir)/applications/chorizo.desktop \
- $(docdir)/chorizo
+ $(datadir)/chorizo
reinstall: uninstall install
-darkreader:
+update-darkreader:
curl -L "https://cdn.jsdelivr.net/npm/darkreader/darkreader.min.js" \
-o user-scripts/darkreader.js
echo >> user-scripts/darkreader.js
>> user-scripts/darkreader.js
clean:
- rm -fv chorizo \
- extensions/*.so \
- man/*.1 \
- man/*.5 \
- user-scripts/darkreader.js
+ rm -fv chorizo extensions/*.so