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