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