prefix = /usr/local
bindir = $(prefix)/bin
INSTALL = install

tl-append: common.o
tl-append-test: common.o

%.o: %.c
	$(CC) -Wall -Wextra -pedantic -std=c99 -o $@ -c $^
%: %.c
	$(CC) -Wall -Wextra -pedantic -std=c99 -o $@ $^

.PHONY: check
check: tl-append tl-append-test
	./tl-append-test

.PHONY: install
install: tl-append
	$(INSTALL) -d $(DESTDIR)$(bindir)
	$(INSTALL) -m 755 $^ $(DESTDIR)$(bindir)

.PHONY: clean
clean:
	-rm tl-append tl-append-test tl.log *.o

tl-append.o: common.h
tl-append-test.o: common.h