catgirl/Makefile

104 lines
2.1 KiB
Makefile
Raw Normal View History

2018-08-20 19:44:57 +00:00
PREFIX = ~/.local
MANDIR = $(PREFIX)/share/man/man
2018-08-13 23:27:22 +00:00
CHROOT_USER = chat
CHROOT_GROUP = $(CHROOT_USER)
LIBRESSL_PREFIX = /usr/local
2018-08-13 23:27:22 +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
-include config.mk
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
OBJS += handle.o
OBJS += input.o
OBJS += irc.o
OBJS += log.o
OBJS += pls.o
2018-12-16 21:21:58 +00:00
OBJS += string.o
OBJS += tab.o
OBJS += tag.o
OBJS += term.o
OBJS += ui.o
OBJS += url.o
TESTS += format.t
2018-12-16 21:21:58 +00:00
TESTS += string.t
2018-09-14 23:41:48 +00:00
TESTS += term.t
2018-11-30 20:41:21 +00:00
all: tags $(BINS) test
$(OBJS): chat.h
catgirl: $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
.SUFFIXES: .t
.c.t:
$(CC) $(CFLAGS) -DTEST $(LDFLAGS) $< $(LDLIBS) -o $@
test: $(TESTS)
set -e; $(TESTS:%=./%;)
tags: *.h *.c
ctags -w *.h *.c
2018-11-30 20:41:21 +00:00
install: $(BINS) $(MANS)
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
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)
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
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
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
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
README: catgirl.7
mandoc catgirl.7 | col -bx > README