Makefile 2.9 KB

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