0.1.0 Makefile
 1# See LICENSE file for copyright and license details.
 2.POSIX:
 3
 4PKG_CONFIG = pkg-config
 5
 6PREFIX = /usr/local
 7
 8PKGS = wayland-client
 9INCS != $(PKG_CONFIG) --cflags $(PKGS)
10LIBS != $(PKG_CONFIG) --libs $(PKGS)
11
12CFLAGS  += -pedantic -Wall -Wno-strict-prototypes -D_GNU_SOURCE $(INCS)
13
14all: wawa
15
16PROTO = xdg-shell-protocol.h xdg-output-unstable-v1-protocol.h \
17	wlr-layer-shell-unstable-v1-protocol.h
18	
19OBJ = wawa.o $(PROTO:.h=.o)
20
21wawa: $(OBJ)
22	$(CC) $(LDFLAGS) $(LIBS) -o $@ $(OBJ)
23wawa.c: $(PROTO)
24
25WAYLAND_PROTOCOLS != $(PKG_CONFIG) --variable=pkgdatadir wayland-protocols
26WAYLAND_SCANNER   != $(PKG_CONFIG) --variable=wayland_scanner wayland-scanner
27
28# I absolutely despise this. Cannot avoid it without using BSD or GNU make.
29xdg-shell-protocol.h:
30	$(WAYLAND_SCANNER) client-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
31xdg-shell-protocol.c:
32	$(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
33xdg-output-unstable-v1-protocol.h:
34	$(WAYLAND_SCANNER) client-header $(WAYLAND_PROTOCOLS)/unstable/xdg-output/xdg-output-unstable-v1.xml $@
35xdg-output-unstable-v1-protocol.c:
36	$(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/unstable/xdg-output/xdg-output-unstable-v1.xml $@
37wlr-layer-shell-unstable-v1-protocol.h:
38	$(WAYLAND_SCANNER) client-header wlr-layer-shell-unstable-v1.xml $@
39wlr-layer-shell-unstable-v1-protocol.c:
40	$(WAYLAND_SCANNER) private-code wlr-layer-shell-unstable-v1.xml $@
41	
42clean:
43	rm -f wawa $(OBJ) $(PROTO) $(PROTO:.h=.c)
44
45install: all
46	mkdir -p $(DESTDIR)$(PREFIX)/bin
47	cp -f wawa $(DESTDIR)$(PREFIX)/bin
48	chmod 755 $(DESTDIR)$(PREFIX)/bin/wawa
49
50uninstall:
51	rm -f $(DESTDIR)$(PREFIX)/bin/wawa
52
53.PHONY: all clean install uninstall