Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. TARGET=bim
  2. CFLAGS=-g -flto -std=c99 -Wvla -pedantic -Wall -Wextra -I. $(shell bash docs/git-tag)
  3. prefix=/usr/local
  4. exec_prefix=$(prefix)
  5. bindir=$(exec_prefix)/bin
  6. INSTALL=install
  7. INSTALL_PROGRAM=$(INSTALL)
  8. SYNTAXES = $(patsubst %.c, %.o, $(wildcard syntax/*.c))
  9. HEADERS = $(wildcard bim-*.h)
  10. .PHONY: all clean distclean install install-strip uninstall
  11. all: $(TARGET)
  12. syntax/*.o: $(HEADERS)
  13. *.o: $(HEADERS)
  14. bim: bim.o $(SYNTAXES)
  15. clean:
  16. -rm -f $(TARGET) bim.o $(SYNTAXES)
  17. distclean: clean
  18. install: all
  19. mkdir -p $(DESTDIR)$(bindir)
  20. $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)/$(TARGET)
  21. install-strip: all
  22. $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
  23. uninstall:
  24. rm -f $(DESTDIR)$(bindir)/$(TARGET)
  25. .PHONY: tags
  26. tags:
  27. ctags --c-kinds=+lx bim.c bim-*.h syntax/*
  28. # Action definitions create functions with the same name
  29. ctags --langdef=bim --language-force=bim --regex-bim='/^BIM_ACTION.([a-zA-Z_]*),/\1/f/' --append bim.c
  30. # Command definitions are prefixed with bim_command_
  31. ctags --langdef=bim --language-force=bim --regex-bim='/^BIM_COMMAND.([a-zA-Z_]*),/bim_command_\1/f/' --append bim.c
  32. ctags --langdef=bim --language-force=bim --regex-bim='/^BIM_PREFIX_COMMAND.([a-zA-Z_]*),/bim_command_\1/f/' --append bim.c
  33. # Flexible arrays create arrays, functions, count, and space objects
  34. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.([a-zA-Z_]*),/\1/v/' --append bim.c
  35. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.[a-zA-Z_]*,([a-zA-Z_]*),/\1/f/' --append bim.c
  36. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.([a-zA-Z_]*),/flex_\1_count/v/' --append bim.c
  37. ctags --langdef=bim --language-force=bim --regex-bim='/^FLEXIBLE_ARRAY.([a-zA-Z_]*),/flex_\1_space/v/' --append bim.c