about summary refs log tree commit diff stats
path: root/linux/GNUmakefile
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2013-10-16 16:27:16 +0200
committerAndrew Shadura <andrew@shadura.me>2013-10-16 16:46:07 +0200
commit4cea11d2553c18bc8a8ae3a384c2dfea321f1b7e (patch)
tree2959323c7a19b86498c9203b309829abd3b0a073 /linux/GNUmakefile
parentfd0f74fe511df46b2d3ba39f3bf5f6e9841e1623 (diff)
downloadxombrero-4cea11d2553c18bc8a8ae3a384c2dfea321f1b7e.tar.gz
Synchronise makefiles, add BSD makefile for Linux.
Diffstat (limited to 'linux/GNUmakefile')
-rw-r--r--linux/GNUmakefile109
1 files changed, 109 insertions, 0 deletions
diff --git a/linux/GNUmakefile b/linux/GNUmakefile
new file mode 100644
index 0000000..f1dbbd1
--- /dev/null
+++ b/linux/GNUmakefile
@@ -0,0 +1,109 @@
+GTK_VERSION?= gtk3
+ifeq ("${GTK_VERSION}", "gtk2")
+JS_CF=$(shell pkg-config --silence-errors --cflags javascriptcoregtk-1.0)
+JS_LD=$(shell pkg-config --silence-errors --libs javascriptcoregtk-1.0)
+else
+JS_CF=$(shell pkg-config --silence-errors --cflags javascriptcoregtk-3.0)
+JS_LD=$(shell pkg-config --silence-errors --libs javascriptcoregtk-3.0)
+endif
+
+LIBS= glib-2.0
+ifeq ("${GTK_VERSION}", "gtk2")
+LIBS+= gtk+-2.0 webkit-1.0
+CFLAGS+=-I/usr/include/gtk-2.0
+else
+LIBS+= gtk+-3.0 webkitgtk-3.0
+CFLAGS+=-I/usr/include/gtk-3.0
+endif
+LIBS+= libsoup-2.4 gnutls libbsd
+
+CFLAGS+= -O2 -Wall -ggdb3 -D_GNU_SOURCE -I. -I.. $(shell pkg-config --cflags $(LIBS)) $(JS_CF)
+LDADD+= $(shell pkg-config --libs $(LIBS)) $(JS_LD) -ldl -lX11
+
+PREFIX?= /usr/local
+BINDIR?= $(PREFIX)/bin
+APPDIR?= $(PREFIX)/share/applications
+MANDIR?= $(PREFIX)/share/man
+RESDIR?= $(PREFIX)/share/xombrero
+
+SRCS= $(shell ls ../*.c)
+SRCS+= linux.c
+OBJS= $(SRCS:.c=.o)
+DEPS= $(addsuffix .depend, $(OBJS))
+
+CC?= gcc
+
+BUILDVERSION= $(shell sh $(CURDIR)/../buildver.sh)
+ifneq ("${BUILDVERSION}", "")
+CFLAGS+= -DXOMBRERO_BUILDSTR=\"$(BUILDVERSION)\"
+endif
+
+all: javascript.h tooltip.h xombrero
+
+javascript.h: ../js-merge-helper.pl ../hinting.js ../autoscroll.js
+	perl ../js-merge-helper.pl ../hinting.js ../input-focus.js \
+	../autoscroll.js > javascript.h
+
+tooltip.h: ../ascii2txt.pl ../txt2tooltip.pl ../xombrero.1
+	nroff -c -Tascii -mandoc ../xombrero.1 | \
+	perl ../ascii2txt.pl | \
+	perl ../txt2tooltip.pl > tooltip.h
+
+xombrero: $(OBJS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LDADD)
+
+%.o: %.c
+	@echo "Generating $@.depend"
+	@$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< | \
+	sed 's,^.*\.o[ :]*,$@ $@.depend : ,g' > $@.depend
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+
+install: all
+	install -m 755 -d $(DESTDIR)$(BINDIR)
+	install -m 755 -d $(DESTDIR)$(MANDIR)/man1
+	install -m 755 -d $(DESTDIR)$(RESDIR)
+	install -m 755 -d $(DESTDIR)$(APPDIR)
+	install -m 755 xombrero $(DESTDIR)$(BINDIR)
+	install -m 644 ../xombrero.1 $(DESTDIR)$(MANDIR)/man1/xombrero.1
+	install -m 644 ../xombrero.css $(DESTDIR)$(RESDIR)
+	install -m 644 ../xombrero.desktop $(DESTDIR)$(APPDIR)
+	install -m 644 ../xombreroicon16.png $(DESTDIR)$(RESDIR)
+	install -m 644 ../xombreroicon32.png $(DESTDIR)$(RESDIR)
+	install -m 644 ../xombreroicon48.png $(DESTDIR)$(RESDIR)
+	install -m 644 ../xombreroicon64.png $(DESTDIR)$(RESDIR)
+	install -m 644 ../xombreroicon128.png $(DESTDIR)$(RESDIR)
+	install -m 644 ../xombreroicon256.png $(DESTDIR)$(RESDIR)
+	install -m 644 ../favicon.ico $(DESTDIR)$(RESDIR)
+	install -m 644 ../tld-rules $(DESTDIR)$(RESDIR)
+	install -m 644 ../style.css $(DESTDIR)$(RESDIR)
+	install -m 644 ../hsts-preload $(DESTDIR)$(RESDIR)
+	install -m 644 ../torenabled.ico $(DESTDIR)$(RESDIR)
+	install -m 644 ../tordisabled.ico $(DESTDIR)$(RESDIR)
+
+uninstall:
+	rm -f $(DESTDIR)$(BINDIR)/xombrero
+	rm -f $(DESTDIR)$(MANDIR)/man1/xombrero.1
+	rm -f $(DESTDIR)$(APPDIR)/xombrero.desktop
+	rm -f $(DESTDIR)$(RESDIR)/xombreroicon16.png
+	rm -f $(DESTDIR)$(RESDIR)/xombreroicon32.png
+	rm -f $(DESTDIR)$(RESDIR)/xombreroicon48.png
+	rm -f $(DESTDIR)$(RESDIR)/xombreroicon64.png
+	rm -f $(DESTDIR)$(RESDIR)/xombreroicon128.png
+	rm -f $(DESTDIR)$(RESDIR)/xombreroicon256.png
+	rm -f $(DESTDIR)$(RESDIR)/xombrero.css
+	rm -f $(DESTDIR)$(RESDIR)/favicon.ico
+	rm -f $(DESTDIR)$(RESDIR)/tordisabled.ico
+	rm -f $(DESTDIR)$(RESDIR)/torenabled.ico
+	rm -f $(DESTDIR)$(RESDIR)/tld-rules
+	rm -f $(DESTDIR)$(RESDIR)/style.css
+	rm -f $(DESTDIR)$(RESDIR)/hsts-preload
+	if [ -d $(DESTDIR)$(RESDIR) ]; then rmdir $(DESTDIR)$(RESDIR); fi
+clean:
+	rm -f xombrero $(OBJS) $(DEPS)
+	rm -f javascript.h
+	rm -f tooltip.h
+
+
+-include $(DEPS)
+
+.PHONY: all install clean