summaryrefslogtreecommitdiff
path: root/Makefile
blob: 2e595caf86f9f2eeba6dce318e949587f36a9a62 (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
include config.mk

WLR_LAYER_SHELL = protocol/wlr-layer-shell-unstable.xml
DWL_IPC = protocol/dwl-bar-ipc-unstable-v1.xml
PROTOCOLS = wlr-layer-shell-protocol.c xdg-shell-protocol.c dwl-bar-ipc-protocol.c
SRC = dmenu-wl.c drw.c util.c wayland.c compositor.c
OBJ = ${SRC:.c=.o} ${PROTOCOLS:.c=.o}

default_target: options dmenu-wl

options:
	@echo ${OBJ}

wlr-layer-shell-protocol.h:
	wayland-scanner client-header < ${WLR_LAYER_SHELL} > $@

wlr-layer-shell-protocol.c: wlr-layer-shell-protocol.h
	wayland-scanner private-code < ${WLR_LAYER_SHELL} > $@

xdg-shell-protocol.h:
	wayland-scanner client-header < ${XDG_SHELL} > $@

xdg-shell-protocol.c: xdg-shell-protocol.h
	wayland-scanner private-code < ${XDG_SHELL} > $@

dwl-bar-ipc-protocol.h:
	wayland-scanner client-header < ${DWL_IPC} > $@

dwl-bar-ipc-protocol.c: dwl-bar-ipc-protocol.h
	wayland-scanner private-code < ${DWL_IPC} > $@

.c.o:
	${CC} -c $< ${CFLAGS}

${OBJ}: ${PROTOCOLS} config.h

dmenu-wl: ${OBJ}
	${CC} -o $@ ${OBJ} ${LDFLAGS}

install: default_target
	mkdir -p ${DESTDIR}${PREFIX}/bin
	install dmenu-wl dmenu_path dmenu-wl_run ${DESTDIR}${PREFIX}/bin
	chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu-wl
	chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu_path
	chmod 755 ${DESTDIR}${PREFIX}/bin/dmenu-wl_run

uninstall:
	rm -f ${DESTDIR}${PREFIX}/bin/dmenu-wl \
	      ${DESTDIR}${PREFIX}/bin/dmenu_path \
	      ${DESTDIR}${PREFIX}/bin/dmenu_run

clean:
	rm ${OBJ} dmenu-wl ${PROTOCOLS} ${PROTOCOLS:.c=.h}

.PHONY: all options clean install uninstall