Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. TARGET=bim
  2. CFLAGS=-g -O2 -std=c99 -Wvla -pedantic -Wall -Wextra -I. $(shell docs/git-tag) -Wno-unused-parameter -Wno-unused-result
  3. LDFLAGS=-rdynamic
  4. ifeq (Darwin,$(shell uname -s))
  5. LDLIBS=/usr/local/lib/libkuroko.a -ldl -lpthread
  6. else
  7. LDLIBS=-l:libkuroko.a -ldl -lpthread
  8. endif
  9. prefix=/usr/local
  10. exec_prefix=$(prefix)
  11. bindir=$(exec_prefix)/bin
  12. datarootdir=$(prefix)/share
  13. datadir=$(datarootdir)
  14. INSTALL=install
  15. INSTALL_PROGRAM=$(INSTALL)
  16. INSTALL_DATA=$(INSTALL) -m 644
  17. SYNTAXES = $(patsubst %.c, %.o, $(sort $(wildcard syntax/*.c)))
  18. HEADERS = $(wildcard bim-*.h)
  19. .PHONY: all clean distclean install install-strip uninstall
  20. all: $(TARGET)
  21. syntax/*.o: $(HEADERS)
  22. *.o: $(HEADERS)
  23. bim: bim.o
  24. clean:
  25. -rm -f $(TARGET) bim.o $(SYNTAXES)
  26. distclean: clean
  27. install: all
  28. mkdir -p $(DESTDIR)$(bindir)
  29. $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)/$(TARGET)
  30. mkdir -p $(DESTDIR)$(datadir)/bim/themes
  31. $(INSTALL_DATA) themes/*.krk $(DESTDIR)$(datadir)/bim/themes/
  32. mkdir -p $(DESTDIR)$(datadir)/bim/syntax
  33. $(INSTALL_DATA) syntax/*.krk $(DESTDIR)$(datadir)/bim/syntax/
  34. install-strip: all
  35. $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
  36. uninstall:
  37. rm -f $(DESTDIR)$(bindir)/$(TARGET)
  38. .PHONY: tags
  39. tags:
  40. ctags --c-kinds=+lx bim.c bim-*.h syntax/*
  41. # Action definitions create functions with the same name
  42. ctags --langdef=bim --language-force=bim --regex-bim='/^BIM_ACTION.([a-zA-Z_]*),/\1/f/' --append bim.c
  43. # Command definitions are prefixed with bim_command_
  44. ctags --langdef=bim --language-force=bim --regex-bim='/^BIM_COMMAND.([a-zA-Z_]*),/bim_command_\1/f/' --append bim.c
  45. ctags --langdef=bim --language-force=bim --regex-bim='/^BIM_PREFIX_COMMAND.([a-zA-Z_]*),/bim_command_\1/f/' --append bim.c
  46. # Flexible arrays create arrays, functions, count, and space objects
  47. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.([a-zA-Z_]*),/\1/v/' --append bim.c
  48. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.[a-zA-Z_]*,([a-zA-Z_]*),/\1/f/' --append bim.c
  49. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.([a-zA-Z_]*),/flex_\1_count/v/' --append bim.c
  50. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.([a-zA-Z_]*),/flex_\1_space/v/' --append bim.c