summaryrefslogtreecommitdiff
path: root/makefile
blob: 5c257db18b05aeab64ca6be1d8ec9fddbcda4568 (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
CFLAGS?=\
	-Wall \
	-Wextra \
	-fvisibility=hidden \
	-flto \
	-Os

LDFLAGS?=\
	-flto \
	-Os \
	-s \
	-lwayland-client \
	-lrt

protocols:=\
	/usr/share/wayland-protocols

wl_headers:=\
	xdg-shell.h

targets:=pui sample.pui

lib_objects:=\
	font.o \
	font_cp00.o \
	font_cp04.o \
	pui.o

bin_objects:=\
	main.o \
	xdg-shell.o \
	libpui.a

all: $(targets)

pui: $(bin_objects)
	$(CC) $(LDFLAGS) $^ -o $@

libpui.a: $(lib_objects)
	$(AR) rs $@ $^

%.o: %.c *.h $(wl_headers)
	$(CC) $(CFLAGS) -c $< -o $@

%.h: $(protocols)/*/*/%.xml
	wayland-scanner client-header $< $@

%.c: $(protocols)/*/*/%.xml
	wayland-scanner private-code $< $@

sample.pui: convert sample.bmp sample.ini
	./$^ > $@

convert: convert.c
	$(CC) $(CFLAGS) -s $< -o $@

clean:
	-rm \
		$(bin_objects) \
		$(lib_objects) \
		$(targets) \
		$(wl_headers) \
		convert \
		libpui.a \
		sample.pui

.PHONY: all clean

.PRECIOUS: $(wl_headers)