This repository has been archived on 2024-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
probotic/Makefile
2023-09-24 17:05:28 +00:00

58 lines
1.2 KiB
Makefile

TARGET:=probotic
USER := probotic
PREFIX = /opt/${USER}/
CFLAGS:=-std=c99 -Wall -Wextra -Wpedantic -Wvla -Wshadow -Wundef
CPPFLAGS:=-I./lib/libircclient/include/ -Iinclude -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -DPROGN=\"${TARGET}\"
LDLIBS:=-lsqlite3
LIB:=./lib/libircclient/src/libircclient.o
SRC := api.c irc.c main.c parse.c unity.c
HDR := config.h api.h error.h irc.h irccolors.h parse.h stmt.h
VPATH := src include
ifeq (${DEBUG},1)
CFLAGS += -Og -ggdb
else
CFLAGS += -O3 -flto=auto -fomit-frame-pointer
endif
ifdef SAN
CFLAGS += -fsanitize=${SAN}
endif
ifeq (${ENABLE_SSL},1)
LDLIBS += -lssl -lcrypto
endif
${TARGET}: include/config.h ${HDR} ${SRC}
${LINK.c} -pipe ${LIB} src/unity.c -o $@ ${LDLIBS}
# do nothing but update them...
${SRC} ${HDR}:
include/config.h: config.mk.h
cp -f $< $@
clean:
-rm ${TARGET}
${PREFIX}:
mkdir $@
bootstrap:
make -C bootstrap
install: bootstrap ${PREFIX}
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}
chown ${USER}:${USER} ${PREFIX} -R
uninstall:
userdel -rf ${USER}
.PHONY: clean bootstrap install uninstall