2018-08-20 19:44:57 +00:00
|
|
|
PREFIX = ~/.local
|
2018-11-28 21:42:28 +00:00
|
|
|
MANDIR = $(PREFIX)/share/man/man
|
2018-08-13 23:27:22 +00:00
|
|
|
CHROOT_USER = chat
|
|
|
|
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
|
|
|
|
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
|
|
|
|
MANS = catgirl.1
|
|
|
|
|
2018-11-28 21:42:28 +00:00
|
|
|
-include config.mk
|
|
|
|
|
2018-08-18 01:50:45 +00:00
|
|
|
OBJS += chat.o
|
|
|
|
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
|
|
|
|
2018-11-30 20:41:21 +00:00
|
|
|
all: tags $(BINS) test
|
2018-08-02 04:29:35 +00:00
|
|
|
|
2018-11-28 21:42:28 +00:00
|
|
|
$(OBJS): chat.h
|
2018-09-14 18:57:32 +00:00
|
|
|
|
2018-11-28 00:13:27 +00:00
|
|
|
catgirl: $(OBJS)
|
2018-08-04 17:35:29 +00:00
|
|
|
$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
|
|
|
|
|
2018-09-14 18:57:32 +00:00
|
|
|
.SUFFIXES: .t
|
|
|
|
|
|
|
|
.c.t:
|
|
|
|
$(CC) $(CFLAGS) -DTEST $(LDFLAGS) $< $(LDLIBS) -o $@
|
2018-08-02 04:29:35 +00:00
|
|
|
|
2018-11-28 21:42:28 +00:00
|
|
|
test: $(TESTS)
|
|
|
|
set -e; $(TESTS:%=./%;)
|
|
|
|
|
|
|
|
tags: *.h *.c
|
|
|
|
ctags -w *.h *.c
|
|
|
|
|
2018-11-30 20:41:21 +00:00
|
|
|
install: $(BINS) $(MANS)
|
2018-11-28 21:42:28 +00:00
|
|
|
install -d $(PREFIX)/bin $(MANDIR)1
|
2018-11-30 20:41:21 +00:00
|
|
|
install $(BINS) $(PREFIX)/bin
|
|
|
|
install -m 644 $(MANS) $(MANDIR)1
|
2018-09-10 20:18:36 +00:00
|
|
|
|
|
|
|
uninstall:
|
2018-11-30 20:41:21 +00:00
|
|
|
rm -f $(BINS:%=$(PREFIX)/bin/%)
|
|
|
|
rm -f $(MAN:%=%(MANDIR)1/%)
|
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 \
|
|
|
|
root/etc \
|
|
|
|
root/home \
|
|
|
|
root/lib \
|
|
|
|
root/libexec \
|
2018-09-10 21:44:23 +00:00
|
|
|
root/usr/bin \
|
2018-08-03 02:02:59 +00:00
|
|
|
root/usr/local/etc/ssl \
|
2018-09-10 21:44:23 +00:00
|
|
|
root/usr/share/man \
|
2018-08-03 02:02:59 +00:00
|
|
|
root/usr/share/misc
|
2018-08-13 23:27:22 +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 \
|
2018-08-03 02:02:59 +00:00
|
|
|
/usr/local/lib/libcrypto.so.43 \
|
|
|
|
/usr/local/lib/libssl.so.45 \
|
|
|
|
/usr/local/lib/libtls.so.17 \
|
|
|
|
root/lib
|
2018-11-28 21:42:28 +00:00
|
|
|
cp -fp /etc/hosts /etc/resolv.conf root/etc
|
|
|
|
cp -fp /usr/local/etc/ssl/cert.pem root/usr/local/etc/ssl
|
|
|
|
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
|
2018-09-10 21:44:23 +00:00
|
|
|
$(MAKE) install PREFIX=root/usr
|
|
|
|
install man.sh root/usr/bin/man
|
2018-11-28 21:42:28 +00:00
|
|
|
tar -cf chroot.tar -C root bin etc home lib libexec usr
|
|
|
|
|
|
|
|
install-chroot: chroot.tar
|
|
|
|
tar -xf chroot.tar -C /home/$(CHROOT_USER)
|
2018-08-03 02:02:59 +00:00
|
|
|
|
2018-08-02 04:29:35 +00:00
|
|
|
clean:
|
2018-11-30 20:41:21 +00:00
|
|
|
rm -fr $(OBJS) $(BINS) $(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
|