Makefile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .POSIX:
  2. PREFIX = /usr/local
  3. BINDIR = $(PREFIX)/bin
  4. MANDIR = $(PREFIX)/share/man
  5. DATADIR = $(PREFIX)/share/inaban
  6. PACKAGE = inaban
  7. DEPS = xkbcommon wlroots wayland-server
  8. EXE = inaban
  9. TRANS =
  10. CC = cc
  11. CFLAGS = -g -Wall -Wextra -Wconversion -Wsign-conversion
  12. CDEPS = -I. `pkg-config --cflags $(DEPS)` -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\" -D_POSIX_C_SOURCE=200809L -DWLR_USE_UNSTABLE
  13. LIBS = `pkg-config --libs $(DEPS)`
  14. WAYLAND_PROTOCOLS=`pkg-config --variable=pkgdatadir wayland-protocols`
  15. WAYLAND_SCANNER=`pkg-config --variable=wayland_scanner wayland-scanner`
  16. all: xdg-shell-protocol.c xdg-decoration-unstable-v1-protocol.c $(EXE) $(TRANS)
  17. po/messages.pot: $(EXE).c
  18. xgettext --keyword=_ --language=C -o $@ --add-comments --sort-output -j $<
  19. po/%.po: po/messages.pot
  20. msgmerge --update $@ $<
  21. ${TRANS}: po/${@:.mo=.po}
  22. mkdir -p locale/${@:.mo=}/LC_MESSAGES
  23. msgfmt -o locale/${@:.mo=}/LC_MESSAGES/$(PACKAGE).mo po/${@:.mo=.po}
  24. inaban: config.h inaban.h inaban.c
  25. .c:
  26. $(CC) -std=c99 $(CFLAGS) $(CDEPS) -o $@ $< $(LDFLAGS) $(LIBS)
  27. xdg-shell-protocol.h:
  28. $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
  29. xdg-shell-protocol.c: xdg-shell-protocol.h
  30. $(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
  31. xdg-decoration-unstable-v1-protocol.h:
  32. $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml $@
  33. xdg-decoration-unstable-v1-protocol.c: xdg-decoration-unstable-v1-protocol.h
  34. $(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml $@
  35. install: all
  36. mkdir -p $(DESTDIR)$(BINDIR)
  37. cp -p $(EXE) $(DESTDIR)$(BINDIR)/$(EXE)
  38. mkdir -p $(DESTDIR)$(MANDIR)/man1
  39. cp -p $(EXE).1 $(DESTDIR)$(MANDIR)/man1
  40. #mkdir -p $(DESTDIR)$(DATADIR)/locale
  41. #cp -r locale/ $(DESTDIR)$(DATADIR)
  42. clean:
  43. rm -fr locale $(EXE) xdg-shell-protocol.c xdg-shell-protocol.h
  44. format: *.c *.h
  45. clang-format -style=file -assume-filename=.clang-format -i *.c *.h
  46. .PHONY: clean install