catboy/Makefile

91 lines
2.0 KiB
Makefile
Raw Normal View History

2018-08-20 19:44:57 +00:00
PREFIX = ~/.local
2018-09-10 20:18:36 +00:00
MANPATH = $(PREFIX)/share/man
LIBRESSL_PREFIX = /usr/local /usr/local/opt/libressl
2018-08-13 23:27:22 +00:00
CHROOT_USER = chat
CHROOT_GROUP = $(CHROOT_USER)
CFLAGS += -Wall -Wextra -Wpedantic
2018-08-13 23:27:22 +00:00
CFLAGS += $(LIBRESSL_PREFIX:%=-I%/include)
LDFLAGS += $(LIBRESSL_PREFIX:%=-L%/lib)
2018-08-03 17:36:41 +00:00
LDLIBS = -lcursesw -ltls
2018-08-13 23:27:22 +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
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
TESTS += format.t
2018-08-20 19:35:00 +00:00
all: tags chatte
tags: *.h *.c
ctags -w *.h *.c
2018-08-20 19:35:00 +00:00
chatte: $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
$(OBJS): chat.h
test: $(TESTS)
$(TESTS:%=./%;)
.SUFFIXES: .t
.c.t:
$(CC) $(CFLAGS) -DTEST $(LDFLAGS) $< $(LDLIBS) -o $@
2018-09-10 20:18:36 +00:00
install: chatte chatte.1
install -d $(PREFIX)/bin $(MANPATH)/man1
install chatte $(PREFIX)/bin/chatte
install -m 644 chatte.1 $(MANPATH)/man1/chatte.1
uninstall:
rm -f $(PREFIX)/bin/chatte
rm -f $(MANPATH)/man1/chatte.1
2018-09-10 23:47:11 +00:00
chroot.tar: chatte chatte.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 -p -f /libexec/ld-elf.so.1 root/libexec
cp -p -f \
2018-08-03 02:02:59 +00:00
/lib/libc.so.7 \
2018-08-04 18:17:18 +00:00
/lib/libedit.so.7 \
2018-08-03 02:02:59 +00:00
/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 -p -f /etc/hosts /etc/resolv.conf root/etc
cp -p -f /usr/local/etc/ssl/cert.pem root/usr/local/etc/ssl
cp -a -f /usr/share/locale root/usr/share
cp -p -f /usr/share/misc/termcap.db root/usr/share/misc
2018-09-10 21:44:23 +00:00
cp -p -f /bin/sh /usr/bin/mandoc /usr/bin/less root/bin
$(MAKE) install PREFIX=root/usr
install man.sh root/usr/bin/man
2018-08-03 02:02:59 +00:00
tar -c -f chroot.tar -C root bin etc home lib libexec usr
clean:
rm -rf tags chatte $(OBJS) $(TESTS) root chroot.tar