]> git.armaanb.net Git - chorizo.git/blobdiff - Makefile
draft 8
[chorizo.git] / Makefile
index 8240e2952499a26d2cf9da2246902458ddc7b724..f634e8864d8d3961746872c9948b771f9aa7a5b3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,69 +1,57 @@
-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
+               $(libdir)/chorizo/web-extensions \
+               $(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 -r extensions/*.so $(libdir)/chorizo/web_extensions/
+
+       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/
 
 uninstall:
        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
@@ -71,8 +59,4 @@ darkreader:
                >> user-scripts/darkreader.js
 
 clean:
-       rm -fv chorizo \
-               extensions/*.so \
-               man/*.1 \
-               man/*.5 \
-               user-scripts/darkreader.js
+       rm -fv chorizo extensions/*.so