about summary refs log tree commit diff
path: root/Makefile
blob: 9e73e1cab7be1390dac804cbf9c3a0c4c677d36c (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.POSIX:
.SUFFIXES:

all: hare-gi

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

BINDINGS_DIR = bindings
MODULES_CORE = \
	types/libc \
	gi/glib \
	gi/gobject \
	gi/gio \
	gi/gmodule
MODULES_GTK_SHARED = \
	gi/atk \
	gi/gdkpixbuf \
	gi/freetype \
	gi/harfbuzz \
	gi/cairo \
	gi/pango \
	gi/xlib
MODULES_GTK3 = $(MODULES_CORE) $(MODULES_GTK_SHARED) \
	gi/gdk \
	gi/gtk
MODULES_GTK4 = $(MODULES_CORE) $(MODULES_GTK_SHARED) \
	gi/gdk4 \
	gi/gtk4 \
	gi/pangocairo \
	gi/graphene \
	gi/gsk

hare-gi:
	hare build -o $@ cmd/hare-gi/
.PHONY: hare-gi

install: install3 install4

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

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

uninstall: uninstall3 uninstall4

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

uninstall4:
	@for mod in $(MODULES_GTK4); 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

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

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 demo3 demo4 bindings/gi/*/_generate.ha

.PHONY: all install3 install4 uninstall3 uninstall4 demo3 demo4 clean