2017-11-14 12:25:10 +00:00
|
|
|
CFLAGS?=-g -O2 -fstack-protector-strong -D_FORTIFY_SOURCE=2
|
|
|
|
override CFLAGS:=-Wall -Wno-switch -Wextra $(CFLAGS)
|
2016-09-05 11:23:58 +00:00
|
|
|
LDLIBS=-lrt
|
2017-05-27 21:51:48 +00:00
|
|
|
|
|
|
|
OS := $(shell uname)
|
|
|
|
|
|
|
|
ifeq ($(OS),OpenBSD)
|
2017-09-16 14:48:55 +00:00
|
|
|
LOCALBASE=/usr/local
|
2017-09-19 12:50:13 +00:00
|
|
|
override CFLAGS+=-I$(LOCALBASE)/include -pthread
|
2017-09-16 14:48:55 +00:00
|
|
|
LDLIBS=-L$(LOCALBASE)/lib -liconv -pthread
|
2016-09-05 12:04:03 +00:00
|
|
|
endif
|
2016-07-11 12:24:04 +00:00
|
|
|
|
2017-05-27 21:51:48 +00:00
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
LDLIBS=-liconv
|
|
|
|
endif
|
|
|
|
|
2016-08-08 12:16:45 +00:00
|
|
|
DESTDIR=
|
|
|
|
PREFIX=/usr/local
|
|
|
|
BINDIR=$(PREFIX)/bin
|
|
|
|
MANDIR=$(PREFIX)/share/man
|
|
|
|
|
2017-07-26 15:23:01 +00:00
|
|
|
ALL = maddr magrep mdate mdeliver mdirs mexport mflag mflow mgenmid mhdr minc mlist mmime mpick mscan msed mseq mshow msort mthread
|
2017-06-20 12:17:24 +00:00
|
|
|
SCRIPT = mcolor mcom mless mmkdir mquote museragent
|
2016-07-11 12:24:04 +00:00
|
|
|
|
2017-06-01 12:57:01 +00:00
|
|
|
all: $(ALL) museragent
|
2016-07-11 12:24:04 +00:00
|
|
|
|
2016-08-23 15:33:55 +00:00
|
|
|
$(ALL) : % : %.o
|
2017-07-26 15:23:01 +00:00
|
|
|
maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \
|
2016-08-23 15:33:55 +00:00
|
|
|
msort mthread : blaze822.o mymemmem.o mytimegm.o
|
2018-04-17 13:15:31 +00:00
|
|
|
maddr magrep mdeliver mexport mflag mgenmid mhdr mlist mpick mscan msed mseq \
|
2019-01-10 15:43:25 +00:00
|
|
|
mshow msort mthread : seq.o slurp.o mystrverscmp.o
|
2017-07-26 15:23:01 +00:00
|
|
|
maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o
|
2017-09-06 15:46:20 +00:00
|
|
|
magrep mflow mhdr mshow : rfc2045.o
|
2017-05-23 13:16:27 +00:00
|
|
|
mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o
|
2017-05-23 13:25:28 +00:00
|
|
|
mscan : pipeto.o
|
2016-10-05 12:44:36 +00:00
|
|
|
mmime : slurp.o
|
2017-07-12 20:31:35 +00:00
|
|
|
minc mlist : squeeze_slash.o
|
2016-07-11 12:24:04 +00:00
|
|
|
|
2017-06-01 12:57:01 +00:00
|
|
|
museragent: FRC
|
2018-08-29 07:53:02 +00:00
|
|
|
@test -n "$$SOURCE_DATE_EPOCH" || BUILDDATE=$$(date '+ (%Y-%m-%d)'); \
|
2018-02-18 16:55:30 +00:00
|
|
|
printf '#!/bin/sh\nprintf "User-Agent: mblaze/%s%s\\n"\n' \
|
2017-06-24 14:01:57 +00:00
|
|
|
"$$({ git describe --always --dirty 2>/dev/null || cat VERSION; } | sed 's/^v//')" \
|
2018-02-18 16:55:30 +00:00
|
|
|
"$$BUILDDATE" >$@
|
2017-06-01 12:57:01 +00:00
|
|
|
@chmod +x $@
|
|
|
|
|
2016-08-01 17:33:25 +00:00
|
|
|
README: man/mblaze.7
|
2016-07-25 15:10:21 +00:00
|
|
|
mandoc -Tutf8 $< | col -bx >$@
|
|
|
|
|
2016-07-11 12:24:04 +00:00
|
|
|
clean: FRC
|
2017-06-01 12:57:01 +00:00
|
|
|
-rm -f $(ALL) *.o museragent
|
2016-07-11 12:24:04 +00:00
|
|
|
|
2017-03-30 13:46:47 +00:00
|
|
|
check: FRC all
|
|
|
|
PATH=$$(pwd):$$PATH prove -v
|
|
|
|
|
2016-08-08 12:16:45 +00:00
|
|
|
install: FRC all
|
2016-09-02 22:22:35 +00:00
|
|
|
mkdir -p $(DESTDIR)$(BINDIR) \
|
|
|
|
$(DESTDIR)$(MANDIR)/man1 \
|
2017-06-25 07:14:30 +00:00
|
|
|
$(DESTDIR)$(MANDIR)/man5 \
|
2016-09-02 22:22:35 +00:00
|
|
|
$(DESTDIR)$(MANDIR)/man7
|
2016-08-08 12:16:45 +00:00
|
|
|
install -m0755 $(ALL) $(SCRIPT) $(DESTDIR)$(BINDIR)
|
2018-01-06 18:17:49 +00:00
|
|
|
ln -sf mcom $(DESTDIR)$(BINDIR)/mbnc
|
2017-06-18 15:48:24 +00:00
|
|
|
ln -sf mcom $(DESTDIR)$(BINDIR)/mfwd
|
2016-09-02 22:50:25 +00:00
|
|
|
ln -sf mcom $(DESTDIR)$(BINDIR)/mrep
|
2018-04-17 13:15:31 +00:00
|
|
|
ln -sf mdeliver $(DESTDIR)$(BINDIR)/mrefile
|
2016-09-02 22:22:35 +00:00
|
|
|
install -m0644 man/*.1 $(DESTDIR)$(MANDIR)/man1
|
2017-02-20 14:39:21 +00:00
|
|
|
install -m0644 man/*.5 $(DESTDIR)$(MANDIR)/man5
|
2016-09-02 22:22:35 +00:00
|
|
|
install -m0644 man/*.7 $(DESTDIR)$(MANDIR)/man7
|
2016-08-08 12:16:45 +00:00
|
|
|
|
2017-06-23 17:40:21 +00:00
|
|
|
release:
|
|
|
|
VERSION=$$(git describe --tags | sed 's/^v//;s/-[^.]*$$//') && \
|
|
|
|
git archive --prefix=mblaze-$$VERSION/ -o mblaze-$$VERSION.tar.gz HEAD
|
|
|
|
|
|
|
|
sign:
|
|
|
|
VERSION=$$(git describe --tags | sed 's/^v//;s/-[^.]*$$//') && \
|
|
|
|
gpg --armor --detach-sign mblaze-$$VERSION.tar.gz && \
|
|
|
|
signify -S -s ~/.signify/mblaze.sec -m mblaze-$$VERSION.tar.gz && \
|
|
|
|
sed -i '1cuntrusted comment: verify with mblaze.pub' mblaze-$$VERSION.tar.gz.sig
|
|
|
|
|
2016-07-11 12:24:04 +00:00
|
|
|
FRC:
|