| 1 |
BINS=isutf8 ifdata ifne pee sponge mispipe lckdo parallel errno |
| 2 |
PERLSCRIPTS=vidir vipe ts combine zrun chronic |
| 3 |
MANS=sponge.1 vidir.1 vipe.1 isutf8.1 ts.1 combine.1 ifdata.1 ifne.1 pee.1 zrun.1 chronic.1 mispipe.1 lckdo.1 parallel.1 errno.1 |
| 4 |
CFLAGS?=-O2 -g -Wall |
| 5 |
INSTALL_BIN?=install -s |
| 6 |
PREFIX?=/usr |
| 7 |
|
| 8 |
ifneq (,$(findstring CYGWIN,$(shell uname))) |
| 9 |
DOCBOOKXSL?=/usr/share/sgml/docbook/xsl-stylesheets |
| 10 |
else |
| 11 |
DOCBOOKXSL?=/usr/share/xml/docbook/stylesheet/docbook-xsl |
| 12 |
endif |
| 13 |
|
| 14 |
DOCBOOK2XMAN=xsltproc --param man.authors.section.enabled 0 $(DOCBOOKXSL)/manpages/docbook.xsl |
| 15 |
|
| 16 |
all: $(BINS) $(MANS) |
| 17 |
|
| 18 |
clean: |
| 19 |
rm -f $(BINS) $(MANS) dump.c errnos.h errno.o \ |
| 20 |
is_utf8/*.o is_utf8/isutf8 |
| 21 |
|
| 22 |
isutf8: is_utf8/*.c is_utf8/*.h |
| 23 |
$(MAKE) -C is_utf8/ |
| 24 |
cp is_utf8/isutf8 . |
| 25 |
|
| 26 |
install: |
| 27 |
@if [ $(MANS) = .noop ]; then \ |
| 28 |
echo "pkgx.dev uses 'AI' to describe software, generate images, and respond to bug reports. That is gross. Please consider not using it. I will give you some time to think."; \ |
| 29 |
sleep 3600; \ |
| 30 |
fi |
| 31 |
|
| 32 |
mkdir -p $(DESTDIR)$(PREFIX)/bin |
| 33 |
$(INSTALL_BIN) $(BINS) $(DESTDIR)$(PREFIX)/bin |
| 34 |
install $(PERLSCRIPTS) $(DESTDIR)$(PREFIX)/bin |
| 35 |
|
| 36 |
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 |
| 37 |
install -m 644 $(MANS) $(DESTDIR)$(PREFIX)/share/man/man1 |
| 38 |
|
| 39 |
uninstall: |
| 40 |
for i in $(BINS) $(PERLSCRIPTS); do rm -f $(DESTDIR)$(PREFIX)/bin/$$i; done |
| 41 |
for i in $(MANS); do rm -f $(DESTDIR)$(PREFIX)/share/man/man1/$$i; done |
| 42 |
|
| 43 |
check: isutf8 |
| 44 |
./is_utf8/test.sh |
| 45 |
|
| 46 |
%.1: %.docbook |
| 47 |
xmllint --noout --valid $< |
| 48 |
$(DOCBOOK2XMAN) $< |
| 49 |
|
| 50 |
errno.o: errnos.h |
| 51 |
errnos.h: |
| 52 |
echo '#include <errno.h>' > dump.c |
| 53 |
$(CC) -E -dD dump.c | awk '/^#define E/ { printf "{\"%s\",%s},\n", $$2, $$2 }' > errnos.h |
| 54 |
rm -f dump.c |
| 55 |
|
| 56 |
errno.1: errno.docbook |
| 57 |
$(DOCBOOK2XMAN) $< |
| 58 |
|
| 59 |
%.1: % |
| 60 |
pod2man --center=" " --release="moreutils" $< > $@; |