archive-logs

Iteratively archive newline separated log files

git clone https://git.8pit.net/archive-logs.git

 1PREFIX ?= /usr/local
 2BINDIR ?= $(PREFIX)/bin
 3MANDIR ?= $(PREFIX)/share/man
 4DOCDIR ?= $(PREFIX)/share/doc/archive-logs
 5
 6CFLAGS ?= -O0 -g -Werror
 7CFLAGS += -std=c99
 8CFLAGS += -Wpedantic -Wall -Wextra \
 9	      -Wmissing-prototypes -Wpointer-arith \
10	      -Wstrict-prototypes -Wshadow -Wformat-nonliteral
11
12# glibc needs _XOPEN_SOURCE for nftw(3)
13CPPFLAGS += -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=500
14
15ifeq ($(HAVE_SENDFILE),1)
16	CPPFLAGS += -DHAVE_SENDFILE
17else
18	HEADERS = compat/sendfile.h
19endif
20
21archive-logs: archive-logs.c $(HEADERS)
22	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@
23check: archive-logs
24	@./tests/run_tests.sh
25
26install: archive-logs archive-logs.1 README.md
27	install -Dm755 archive-logs "$(DESTDIR)$(BINDIR)/archive-logs"
28	install -Dm644 archive-logs.1 "$(DESTDIR)$(MANDIR)/man1/archive-logs.1"
29	install -Dm644 README.md "$(DESTDIR)$(DOCDIR)/README.md"
30
31.PHONY: check install