## Project specific variables PROG = sockchat CSTD = c99 ## Custom variable defaults BUILD ?= debug ## Built-in variable defaults WFLAGS += -Werror WFLAGS += -Wpedantic -Wall -Wextra WFLAGS += -Wconversion -Wno-sign-conversion WFLAGS += -Wshadow WFLAGS += -Wimplicit-fallthrough WFLAGS += -Wvla CFLAGS += $(WFLAGS) -std=$(CSTD) ## Standard variable defaults PREFIX ?= /usr/local DESTDIR ?= INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) ## Build type ifeq ($(BUILD),debug) CFLAGS += -g CFLAGS += -fsanitize=signed-integer-overflow 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)