about summary refs log tree commit diff
path: root/Makefile
blob: b48219bba652b07b16955b3e95a98d41c4cbe4d1 (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
.POSIX:
.SUFFIXES:

BINDINGS_DIR = bindings
CORE_MODULES = glib gobject gio gmodule atk gdkpixbuf freetype harfbuzz cairo pango xlib types/libc
MODULES3 = $(CORE_MODULES) gdk gtk
MODULES4 = $(CORE_MODULES) gdk4 gtk4 pangocairo graphene gsk

DESTDIR =
PREFIX = /usr/local
SRCDIR = $(PREFIX)/src
HARESRCDIR = $(SRCDIR)/hare
THIRDPARTYDIR = $(HARESRCDIR)/third-party

all:
	@true

install:
	@for mod in $(MODULES3); do \
		printf "installing %s\n" "$$mod"; \
		mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
		install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
	done

install4:
	@for mod in $(MODULES4); do \
		printf "installing %s\n" "$$mod"; \
		mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
		install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
	done

uninstall:
	@for mod in $(MODULES3); do \
		printf "uninstalling %s\n" "$$mod"; \
		rm -r "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
	done

uninstall4:
	@for mod in $(MODULES4); do \
		printf "uninstalling %s\n" "$$mod"; \
		rm -r "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
	done

HAREPATH_CMD = hare version -v | awk 'harepath { gsub(/^\t/, ""); print }; /^HAREPATH/ { harepath = 1 }' | tr '\n' ':'

demo:
	env HAREPATH="$(BINDINGS_DIR):$$($(HAREPATH_CMD))" \
		hare build $$(pkg-config --libs-only-l --static gtk+-3.0) -lbsd -o demo cmd/demo

demo4:
	env HAREPATH="$(BINDINGS_DIR):$$($(HAREPATH_CMD))" \
		hare build $$(pkg-config --libs-only-l --static gtk4) -lepoxy -lXi -lxkbcommon -lwayland-client -lwayland-egl -lXfixes -lXcursor -lXdamage -lXrandr -lXinerama -lcairo-script-interpreter -lbsd -o demo4 cmd/demo4

clean:
	rm -f hare-gi xmltree demo demo4

.PHONY: all install install4 uninstall uninstall4 demo demo4 clean