TARGET:=hl CFLAGS := -std=c99 CPPFLAGS := -Iinclude -D_GNU_SOURCE DEBUG=1 ifeq (${DEBUG},1) CFLAGS += -Og -ggdb -pg -fno-inline -Wall -Wextra -Wpedantic -Wshadow -Wundef else CFLAGS += -O2 -flto=auto -D_FORTIFY_SOURCE=2 endif PREFIX:=/usr/bin USER=$(shell whoami) include chad.mk SRC.dir := source OBJ.dir := object SRC:=$(addprefix $(SRC.dir)/,hl.c jeger.c main.c terminal.c vector.c) HDR:=chad.h hl.h jeger.h terminal.h vector.h OBJ:=$(subst $(SRC.dir),$(OBJ.dir),$(SRC:.c=.o)) VPATH=${SRC.dir} ${OBJ.dir} ${OBJ.dir}/%.o: ${SRC.dir}/%.c ${COMPILE.c} $< -o $@ ${TARGET}: ${OBJ} | ${HDR} ${LINK.c} $+ -o $@ ${SRC} ${HDR}: install: ${PREFIX} install -v -g ${USER} -o ${USER} -m 744 ${TARGET} ${PREFIX}/ uninstall: -rm ${PREFIX}/bin/${TARGET} clean: -rm ${OBJ} ${TARGET} test: chad_test run: hl < source/main.c .PHONY: test clean install run .DEFAULT_GOAL:=${TARGET}