logo

inaban

Unnamed repository; edit this file 'description' to name the repository.

Makefile (1825B)


  1. # POSIX-ish Makefile with extensions common to *BSD and GNU such as:
  2. # - Usage of backticks for shell evaluation
  3. # - Usage of ?= for defining variables when not already defined
  4. # - Usage of += for appending to a variable
  5. VERSION = 0.0.1
  6. VERSION_FULL = $(VERSION)`./version.sh`
  7. PREFIX = /usr/local
  8. BINDIR = $(PREFIX)/bin
  9. MANDIR = $(PREFIX)/share/man
  10. DATADIR = $(PREFIX)/share/inaban
  11. CC ?= cc
  12. CFLAGS ?= -g -Wall -Wextra -Wconversion -Wsign-conversion -O2
  13. DBG ?=
  14. PKGCONFIG ?= pkg-config
  15. DEPS = xkbcommon wlroots wayland-server
  16. EXE = inaban
  17. TRANS =
  18. CDEPS = -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\" -D_POSIX_C_SOURCE=200809L -DWLR_USE_UNSTABLE -I.
  19. CDEPS += `pkg-config --cflags $(DEPS)`
  20. LIBS = `pkg-config --libs $(DEPS)`
  21. WAYLAND_PROTOCOLS=`pkg-config --variable=pkgdatadir wayland-protocols`
  22. WAYLAND_SCANNER=`pkg-config --variable=wayland_scanner wayland-scanner`
  23. all: xdg-shell-protocol.c $(EXE) $(TRANS)
  24. inaban: inaban.c inaban.h config.h
  25. $(CC) -std=c99 $(CFLAGS) $(CDEPS) $(LDFLAGS) $(LIBS) -o $@ $<
  26. .c:
  27. $(CC) -std=c99 $(CFLAGS) $(CDEPS) $(LDFLAGS) $(LIBS) -o $@ $<
  28. .c.o:
  29. $(CC) -std=c99 $(CFLAGS) $(CDEPS) -c -o $@ $<
  30. xdg-shell-protocol.h:
  31. $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
  32. xdg-shell-protocol.c: xdg-shell-protocol.h
  33. $(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
  34. install: all
  35. mkdir -p $(DESTDIR)$(BINDIR)
  36. cp -p $(EXE) $(DESTDIR)$(BINDIR)/$(EXE)
  37. mkdir -p $(DESTDIR)$(MANDIR)/man1
  38. cp -p $(EXE).1 $(DESTDIR)$(MANDIR)/man1
  39. #mkdir -p $(DESTDIR)$(DATADIR)/locale
  40. #cp -r locale/ $(DESTDIR)$(DATADIR)
  41. clean:
  42. rm -fr locale $(EXE) xdg-shell-protocol.c xdg-shell-protocol.h
  43. format: *.c *.h
  44. clang-format -style=file -assume-filename=.clang-format -i *.c *.h
  45. .PHONY: clean install