libhl/Makefile
2023-08-28 13:03:03 -06:00

52 lines
794 B
Makefile

TARGET:=hl
CFLAGS:=-std=c99
CPPFLAGS:=-Iinclude -D_GNU_SOURCE -D_FORTIFY_SOURCE=2
DEBUG=1
ifeq (${DEBUG},1)
CFLAGS += -Og -ggdb -pg -fno-inline
else
CFLAGS += -O2 -flto=auto
endif
PREFIX:=/usr/bin
USER=$(shell whoami)
include chad.mk
SRC.dir:=source
OBJ.dir:=object
SRC:=$(shell find ${SRC.dir} -iname '*.c')
HDR:=$(shell find ${SRC.dir} -iname '*.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}: ${HDR} | ${OBJ}
${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}
-rm *.out
test: chad_test
.PHONY: test clean install
.DEFAULT_GOAL:=${TARGET}