2023-09-24 13:05:28 -04:00
|
|
|
TARGET:=probotic
|
2023-08-06 22:51:57 -04:00
|
|
|
|
2023-08-12 19:34:37 -04:00
|
|
|
USER := probotic
|
|
|
|
PREFIX = /opt/${USER}/
|
|
|
|
|
2023-08-06 22:51:57 -04:00
|
|
|
CFLAGS:=-std=c99 -Wall -Wextra -Wpedantic -Wvla -Wshadow -Wundef
|
2023-09-24 13:05:28 -04:00
|
|
|
CPPFLAGS:=-I./lib/libircclient/include/ -Iinclude -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -DPROGN=\"${TARGET}\"
|
2023-08-06 22:51:57 -04:00
|
|
|
|
2023-08-07 07:13:13 -04:00
|
|
|
LDLIBS:=-lsqlite3
|
|
|
|
LIB:=./lib/libircclient/src/libircclient.o
|
2023-08-06 22:51:57 -04:00
|
|
|
|
2023-08-04 11:13:47 -04:00
|
|
|
SRC := api.c irc.c main.c parse.c unity.c
|
2023-08-07 10:04:15 -04:00
|
|
|
HDR := config.h api.h error.h irc.h irccolors.h parse.h stmt.h
|
|
|
|
|
|
|
|
VPATH := src include
|
2023-08-04 11:13:47 -04:00
|
|
|
|
2023-08-06 22:51:57 -04:00
|
|
|
ifeq (${DEBUG},1)
|
|
|
|
CFLAGS += -Og -ggdb
|
|
|
|
else
|
|
|
|
CFLAGS += -O3 -flto=auto -fomit-frame-pointer
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef SAN
|
|
|
|
CFLAGS += -fsanitize=${SAN}
|
|
|
|
endif
|
|
|
|
|
2023-08-07 07:13:13 -04:00
|
|
|
ifeq (${ENABLE_SSL},1)
|
|
|
|
LDLIBS += -lssl -lcrypto
|
|
|
|
endif
|
|
|
|
|
2023-09-24 13:05:28 -04:00
|
|
|
${TARGET}: include/config.h ${HDR} ${SRC}
|
2023-08-07 07:13:13 -04:00
|
|
|
${LINK.c} -pipe ${LIB} src/unity.c -o $@ ${LDLIBS}
|
2023-08-04 11:13:47 -04:00
|
|
|
|
|
|
|
# do nothing but update them...
|
2023-08-07 10:04:15 -04:00
|
|
|
${SRC} ${HDR}:
|
2023-08-06 22:51:57 -04:00
|
|
|
|
2023-08-07 10:04:15 -04:00
|
|
|
include/config.h: config.mk.h
|
|
|
|
cp -f $< $@
|
|
|
|
|
2023-08-06 22:51:57 -04:00
|
|
|
clean:
|
2023-09-24 13:05:28 -04:00
|
|
|
-rm ${TARGET}
|
2023-08-07 07:13:13 -04:00
|
|
|
|
2023-08-12 19:34:37 -04:00
|
|
|
${PREFIX}:
|
|
|
|
mkdir $@
|
|
|
|
|
|
|
|
bootstrap:
|
|
|
|
make -C bootstrap
|
|
|
|
|
|
|
|
install: bootstrap ${PREFIX}
|
2023-09-24 13:05:28 -04:00
|
|
|
useradd ${USER} -r -s /sbin/nologin -d ${PREFIX} || true # Bypass "Already Exists"
|
|
|
|
install -v -g ${USER} -o ${USER} -m 744 ./bootstrap/data.sqlite ${TARGET} ${PREFIX}
|
2023-08-12 19:34:37 -04:00
|
|
|
chown ${USER}:${USER} ${PREFIX} -R
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
userdel -rf ${USER}
|
|
|
|
|
|
|
|
.PHONY: clean bootstrap install uninstall
|