2018-08-20 19:44:57 +00:00
|
|
|
PREFIX = ~/.local
|
2019-07-27 22:05:06 +00:00
|
|
|
MANDIR = ${PREFIX}/share/man
|
2018-08-13 23:27:22 +00:00
|
|
|
CHROOT_USER = chat
|
2019-07-27 22:05:06 +00:00
|
|
|
CHROOT_GROUP = ${CHROOT_USER}
|
2018-11-28 21:42:28 +00:00
|
|
|
LIBRESSL_PREFIX = /usr/local
|
2018-08-13 23:27:22 +00:00
|
|
|
|
2018-11-28 21:42:28 +00:00
|
|
|
CFLAGS += -std=c11 -Wall -Wextra -Wpedantic
|
2019-07-27 22:05:06 +00:00
|
|
|
CFLAGS += -I${LIBRESSL_PREFIX}/include
|
|
|
|
LDFLAGS += -L${LIBRESSL_PREFIX}/lib
|
2018-08-03 17:36:41 +00:00
|
|
|
LDLIBS = -lcursesw -ltls
|
2018-08-13 23:27:22 +00:00
|
|
|
|
2018-11-30 20:41:21 +00:00
|
|
|
BINS = catgirl
|
2019-07-27 22:05:06 +00:00
|
|
|
MANS = catgirl.1
|
2018-11-30 20:41:21 +00:00
|
|
|
|
2018-11-28 21:42:28 +00:00
|
|
|
-include config.mk
|
|
|
|
|
2018-08-18 01:50:45 +00:00
|
|
|
OBJS += chat.o
|
2019-02-26 04:10:40 +00:00
|
|
|
OBJS += color.o
|
2018-08-18 01:50:45 +00:00
|
|
|
OBJS += edit.o
|
2018-09-06 04:41:06 +00:00
|
|
|
OBJS += event.o
|
2018-09-13 00:23:45 +00:00
|
|
|
OBJS += format.o
|
2018-08-18 01:50:45 +00:00
|
|
|
OBJS += handle.o
|
|
|
|
OBJS += input.o
|
|
|
|
OBJS += irc.o
|
|
|
|
OBJS += log.o
|
|
|
|
OBJS += pls.o
|
|
|
|
OBJS += tab.o
|
|
|
|
OBJS += tag.o
|
|
|
|
OBJS += term.o
|
|
|
|
OBJS += ui.o
|
|
|
|
OBJS += url.o
|
2018-08-02 04:29:35 +00:00
|
|
|
|
2018-09-14 18:57:32 +00:00
|
|
|
TESTS += format.t
|
2018-12-16 21:57:43 +00:00
|
|
|
TESTS += pls.t
|
2018-09-14 23:41:48 +00:00
|
|
|
TESTS += term.t
|
2018-09-14 18:57:32 +00:00
|
|
|
|
2019-07-27 22:05:06 +00:00
|
|
|
all: tags ${BINS} test
|
2018-08-02 04:29:35 +00:00
|
|
|
|
2019-07-27 22:05:06 +00:00
|
|
|
catgirl: ${OBJS}
|
|
|
|
${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@
|
2018-08-04 17:35:29 +00:00
|
|
|
|
2019-07-27 22:05:06 +00:00
|
|
|
${OBJS}: chat.h
|
2019-01-25 01:42:27 +00:00
|
|
|
|
2019-07-27 22:05:06 +00:00
|
|
|
test: ${TESTS}
|
|
|
|
set -e; ${TESTS:%=./%;}
|
2019-01-25 01:42:27 +00:00
|
|
|
|
2018-09-14 18:57:32 +00:00
|
|
|
.SUFFIXES: .t
|
|
|
|
|
|
|
|
.c.t:
|
2019-07-27 22:05:06 +00:00
|
|
|
${CC} ${CFLAGS} -DTEST ${LDFLAGS} $< ${LDLIBS} -o $@
|
2018-08-02 04:29:35 +00:00
|
|
|
|
2019-01-25 01:42:27 +00:00
|
|
|
tags: *.c *.h
|
|
|
|
ctags -w *.c *.h
|
2018-11-28 21:42:28 +00:00
|
|
|
|
2019-07-27 22:05:06 +00:00
|
|
|
install: ${BINS} ${MANS}
|
|
|
|
install -d ${PREFIX}/bin ${MANDIR}/man1
|
|
|
|
install ${BINS} ${PREFIX}/bin
|
|
|
|
install -m 644 ${MANS} ${MANDIR}/man1
|
2018-09-10 20:18:36 +00:00
|
|
|
|
|
|
|
uninstall:
|
2019-07-27 22:05:06 +00:00
|
|
|
rm -f ${BINS:%=${PREFIX}/bin/%}
|
|
|
|
rm -f ${MANS:%=${MANDIR}/man1/%}
|
2018-09-10 20:18:36 +00:00
|
|
|
|
2018-11-28 00:13:27 +00:00
|
|
|
chroot.tar: catgirl catgirl.1 man.sh
|
2018-08-03 02:02:59 +00:00
|
|
|
install -d -o root -g wheel \
|
2018-09-10 21:44:23 +00:00
|
|
|
root \
|
2018-08-03 02:02:59 +00:00
|
|
|
root/bin \
|
2019-09-16 21:24:19 +00:00
|
|
|
root/etc/ssl \
|
2018-08-03 02:02:59 +00:00
|
|
|
root/home \
|
|
|
|
root/lib \
|
|
|
|
root/libexec \
|
2018-09-10 21:44:23 +00:00
|
|
|
root/usr/bin \
|
|
|
|
root/usr/share/man \
|
2018-08-03 02:02:59 +00:00
|
|
|
root/usr/share/misc
|
2019-07-27 22:05:06 +00:00
|
|
|
install -d -o ${CHROOT_USER} -g ${CHROOT_GROUP} root/home/${CHROOT_USER}
|
2018-11-28 21:42:28 +00:00
|
|
|
cp -fp /libexec/ld-elf.so.1 root/libexec
|
|
|
|
cp -fp \
|
2018-08-03 02:02:59 +00:00
|
|
|
/lib/libc.so.7 \
|
|
|
|
/lib/libncursesw.so.8 \
|
|
|
|
/lib/libthr.so.3 \
|
2018-09-10 21:44:23 +00:00
|
|
|
/lib/libz.so.6 \
|
2019-09-16 21:17:58 +00:00
|
|
|
/usr/local/lib/libcrypto.so.45 \
|
|
|
|
/usr/local/lib/libssl.so.47 \
|
|
|
|
/usr/local/lib/libtls.so.19 \
|
2018-08-03 02:02:59 +00:00
|
|
|
root/lib
|
2018-11-28 21:42:28 +00:00
|
|
|
cp -fp /etc/hosts /etc/resolv.conf root/etc
|
2019-09-16 21:24:19 +00:00
|
|
|
cp -fp /etc/ssl/cert.pem root/etc/ssl
|
2018-11-28 21:42:28 +00:00
|
|
|
cp -af /usr/share/locale root/usr/share
|
|
|
|
cp -fp /usr/share/misc/termcap.db root/usr/share/misc
|
|
|
|
cp -fp /rescue/sh /usr/bin/mandoc /usr/bin/less root/bin
|
2019-07-27 22:05:06 +00:00
|
|
|
${MAKE} install PREFIX=root/usr
|
2018-09-10 21:44:23 +00:00
|
|
|
install man.sh root/usr/bin/man
|
2019-01-25 01:46:33 +00:00
|
|
|
tar -c -f chroot.tar -C root bin etc home lib libexec usr
|
2018-11-28 21:42:28 +00:00
|
|
|
|
|
|
|
install-chroot: chroot.tar
|
2019-07-27 22:05:06 +00:00
|
|
|
tar -x -f chroot.tar -C /home/${CHROOT_USER}
|
2018-08-03 02:02:59 +00:00
|
|
|
|
2018-08-02 04:29:35 +00:00
|
|
|
clean:
|
2019-07-27 22:05:06 +00:00
|
|
|
rm -fr ${BINS} ${OBJS} ${TESTS} tags root chroot.tar
|
2018-09-16 02:22:51 +00:00
|
|
|
|
2018-11-28 00:13:27 +00:00
|
|
|
README: catgirl.7
|
2018-11-28 21:42:28 +00:00
|
|
|
mandoc catgirl.7 | col -bx > README
|