libhl/Makefile

52 lines
794 B
Makefile
Raw Normal View History

2023-08-28 14:56:34 -04:00
TARGET:=hl
CFLAGS:=-std=c99
2023-08-28 15:03:03 -04:00
CPPFLAGS:=-Iinclude -D_GNU_SOURCE -D_FORTIFY_SOURCE=2
2023-08-28 14:56:34 -04:00
DEBUG=1
ifeq (${DEBUG},1)
CFLAGS += -Og -ggdb -pg -fno-inline
else
CFLAGS += -O2 -flto=auto
endif
PREFIX:=/usr/bin
USER=$(shell whoami)
2023-08-21 09:30:48 -04:00
include chad.mk
2023-08-21 09:05:27 -04:00
SRC.dir:=source
2023-08-21 09:30:48 -04:00
OBJ.dir:=object
2023-08-16 01:06:37 -04:00
SRC:=$(shell find ${SRC.dir} -iname '*.c')
HDR:=$(shell find ${SRC.dir} -iname '*.h')
2023-08-21 09:25:14 -04:00
OBJ:=$(subst $(SRC.dir),$(OBJ.dir),$(SRC:.c=.o))
2023-08-21 09:05:27 -04:00
VPATH=${SRC.dir} ${OBJ.dir}
2023-08-21 09:05:27 -04:00
${OBJ.dir}/%.o: ${SRC.dir}/%.c
2023-08-16 01:06:37 -04:00
${COMPILE.c} $< -o $@
2023-08-23 22:45:13 -04:00
${TARGET}: ${HDR} | ${OBJ}
2023-08-21 09:25:14 -04:00
${LINK.c} $| -o $@
2023-08-21 09:05:27 -04:00
${SRC} ${HDR}:
install: ${PREFIX}
2023-08-27 03:31:36 -04:00
install -v -g ${USER} -o ${USER} -m 744 ${TARGET} ${PREFIX}/
2023-08-21 09:05:27 -04:00
uninstall:
-rm ${PREFIX}/bin/${TARGET}
clean:
2023-08-21 09:05:27 -04:00
-rm ${OBJ} ${TARGET}
2023-08-24 13:16:40 -04:00
-rm *.out
2023-08-16 11:30:29 -04:00
test: chad_test
2023-08-21 09:05:27 -04:00
.PHONY: test clean install
.DEFAULT_GOAL:=${TARGET}