## Project specific variables
PROG = sockchat

## Custom variable defaults
BUILD ?= debug

## Built-in variable defaults
CFLAGS += -Wall -Wextra -Werror -pedantic

## Standard variable defaults
PREFIX ?= /usr/local
DESTDIR ?=
INSTALL ?= install
INSTALL_PROGRAM ?= $(INSTALL)

## Build type
ifeq ($(BUILD),debug)
    CFLAGS += -g
else ifeq ($(BUILD),release)
    CFLAGS += -DNDEBUG -O3
    LDFLAGS += -s
endif

## Standard targets

.PHONY: all
all: $(PROG)

.PHONY: install
install: all
	$(INSTALL_PROGRAM) -D -t $(DESTDIR)$(PREFIX)/bin $(PROG)

.PHONY: clean
clean:

.PHONY: distclean
distclean: clean
	$(RM) $(PROG)