DESTDIR ?=
PREFIX ?= /usr/local
EXEC_PREFIX ?= $(PREFIX)
BINDIR ?= $(EXEC_PREFIX)/bin

CFLAGS ?= -std=gnu11 -Os -Wall -Wextra -pedantic

.SUFFIXES:
.SUFFIXES: .c .o

all: puer

puer: puer.o
	$(CC) $(LDFLAGS) -o $@ $<

.c.o:
	$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<

clean:
	rm -f puer *.o

distclean: clean

install: puer
	install -D -m 775 -t '$(DESTDIR)$(BINDIR)' puer

uninstall:
	cd $(DESTDIR)$(BINDIR) && rm puer

.PHONY: all clean distclean install uninstall
.DEFAULT: all