PREFIX ?= /usr/local
CFLAGS ?= -O2 -Wall -Wextra -std=c99

ttyfence: src/ttyfence.c
	$(CC) $(CFLAGS) -o $@ src/ttyfence.c

test: ttyfence
	sh tests/run.sh

install: ttyfence
	install -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/share/man/man1
	install -m 755 ttyfence $(DESTDIR)$(PREFIX)/bin/
	install -m 644 ttyfence.1 $(DESTDIR)$(PREFIX)/share/man/man1/

clean:
	rm -f ttyfence tests/*.out

.PHONY: test install clean
