1NAME = input
2
3PREFIX ?= /usr/local
4BINDIR ?= $(PREFIX)/bin
5MANDIR ?= $(PREFIX)/share/man
6DOCDIR ?= $(PREFIX)/share/doc/$(NAME)
7
8CFLAGS ?= -O0 -g -Werror
9CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809L
10CFLAGS += -Wpedantic -Wall -Wextra \
11 -Wmissing-prototypes -Wpointer-arith \
12 -Wstrict-prototypes -Wshadow -Wformat-nonliteral
13
14LDLIBS = -lreadline -lncurses
15
16$(NAME): $(NAME).c
17check: $(NAME)
18 cd tests/ && ./run_tests.sh
19
20format: $(SOURCES)
21 clang-format -style=file -i $(NAME).c
22
23install: $(NAME) $(NAME).1 README.md
24 install -Dm755 $(NAME) "$(DESTDIR)$(BINDIR)/$(NAME)"
25 install -Dm644 $(NAME).1 "$(DESTDIR)$(MANDIR)/man1/$(NAME).1"
26 install -Dm644 README.md "$(DESTDIR)$(DOCDIR)/README.md"
27
28.PHONY: check format install