Makefile (3175B)
1 .POSIX: 2 .SUFFIXES: 3 4 include config.mk 5 6 # flags for compiling 7 DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND) 8 DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wshadow -Wunused-macros\ 9 -Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion 10 11 # CFLAGS / LDFLAGS 12 PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS) 13 DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS) 14 LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS) 15 16 PREFIX = $(HOME)/.local 17 18 all: dwl 19 dwl: dwl.o util.o dwl-ipc-unstable-v2-protocol.o 20 $(CC) dwl.o util.o dwl-ipc-unstable-v2-protocol.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@ 21 dwl.o: dwl.c config.mk device.h config.h client.h cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h dwl-ipc-unstable-v2-protocol.h 22 util.o: util.c util.h 23 dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c dwl-ipc-unstable-v2-protocol.h 24 25 # wayland-scanner is a tool which generates C headers and rigging for Wayland 26 # protocols, which are specified in XML. wlroots requires you to rig these up 27 # to your build system yourself and provide them in the include path. 28 WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner` 29 WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols` 30 31 cursor-shape-v1-protocol.h: 32 $(WAYLAND_SCANNER) server-header \ 33 $(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@ 34 pointer-constraints-unstable-v1-protocol.h: 35 $(WAYLAND_SCANNER) server-header \ 36 $(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@ 37 wlr-layer-shell-unstable-v1-protocol.h: 38 $(WAYLAND_SCANNER) server-header \ 39 protocols/wlr-layer-shell-unstable-v1.xml $@ 40 xdg-shell-protocol.h: 41 $(WAYLAND_SCANNER) server-header \ 42 $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ 43 dwl-ipc-unstable-v2-protocol.h: 44 $(WAYLAND_SCANNER) server-header \ 45 protocols/dwl-ipc-unstable-v2.xml $@ 46 dwl-ipc-unstable-v2-protocol.c: 47 $(WAYLAND_SCANNER) private-code \ 48 protocols/dwl-ipc-unstable-v2.xml $@ 49 50 clean: 51 rm -f dwl *.o *-protocol.h *.patch *.rej *.orig 52 53 dist: clean 54 mkdir -p dwl-$(VERSION) 55 cp -R LICENSE* Makefile CHANGELOG.md README.md client.h config.def.h\ 56 config.mk protocols dwl.1 dwl.c util.c util.h dwl.desktop\ 57 dwl-$(VERSION) 58 tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION) 59 rm -rf dwl-$(VERSION) 60 61 install: dwl 62 mkdir -p $(DESTDIR)$(PREFIX)/bin 63 cp -f dwl $(DESTDIR)$(PREFIX)/bin 64 chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl 65 mkdir -p $(DESTDIR)$(MANDIR)/man1 66 cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1 67 chmod 644 $(DESTDIR)$(MANDIR)/man1/dwl.1 68 mkdir -p $(DESTDIR)$(DATADIR)/wayland-sessions 69 cp -f dwl.desktop $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop 70 chmod 644 $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop 71 uninstall: 72 rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop 73 74 .SUFFIXES: .c .o 75 .c.o: 76 $(CC) $(CPPFLAGS) $(DWLCFLAGS) -c $<