aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: be0e243b6be33d016e541444b96c91e3040832e8 (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
PREFIX = /usr

DEPS = wayland-client wayland-cursor xkbcommon \
       fontconfig pixman-1 libdrm_intel
XDG_SHELL_PROTO = `pkg-config --variable=pkgdatadir wayland-protocols`/stable/xdg-shell/xdg-shell.xml
WLD_FLAGS = DRM_DRIVERS=intel

LDFLAGS = -L/usr/lib -lc -lm -lrt -lutil \
          `pkg-config --libs ${DEPS}` lib/wld/libwld.a
CFLAGS = -I. -I/usr/include `pkg-config --cflags ${DEPS}` \
         -DVERSION=\"0.9\" -D_XOPEN_SOURCE=600

SRC = st.c wl.c xdg-shell-protocol.c
OBJ = $(SRC:.c=.o)

ifeq ($(if $(V),$(V),0), 0)
	define quiet
        @echo "  $1	$@"
        @$(if $2,$2,$($1))
    endef
else
    quiet = $(if $2,$2,$($1))
endif

all: wld st

xdg-shell-protocol.c:
	$(call quiet,GEN)
	@wayland-scanner private-code $(XDG_SHELL_PROTO) $@

xdg-shell-client-protocol.h:
	$(call quiet,GEN)
	@wayland-scanner client-header $(XDG_SHELL_PROTO) $@

.c.o:
	$(call quiet,CC) $(CFLAGS) -c $<

st.o: st.h win.h
wl.o: arg.h st.h win.h config.h xdg-shell-client-protocol.h

$(OBJ): config.h

st: $(OBJ)
	$(call quiet,LD,cc) -o $@ $(OBJ) $(LDFLAGS)

wld:
	make -sC lib/wld ${WLD_FLAGS}

clean:
	rm -f st $(OBJ) xdg-shell-*
	make -C lib/wld clean

install: st
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	cp -f st $(DESTDIR)$(PREFIX)/bin
	chmod 755 $(DESTDIR)$(PREFIX)/bin/st

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/st