about summary refs log tree commit diff
path: root/Makefile
blob: 9b658bbe671cb3b875ed55776c08d10692c2aaba (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
58
59
60
61
62
63
64
.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_ENV_CMD = hare version -vv | grep '^HAREPATH'

# hare version -vv returns the value of HAREPATH in form
# HAREPATH=<possibly shell-quoted string>
#
# Using eval on that line will set the HAREPATH variable in the environment to
# the unquoted value, which makes it easy to add the bindings directory to the
# path

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

demo4:
	eval "$$($(HAREPATH_ENV_CMD))" && env HAREPATH="$(BINDINGS_DIR):$$HAREPATH" \
		hare build $$(pkg-config --libs-only-l gtk4) -o demo4 cmd/demo4

clean:
	rm -f hare-gi xmltree demo demo4

.PHONY: all install install4 uninstall uninstall4 demo demo4 clean