1 babf5d5a 2021-05-11 martijn LOCALBASE?= /usr/local/
3 babf5d5a 2021-05-11 martijn PROG= filter-dkimsign
4 babf5d5a 2021-05-11 martijn MAN= filter-dkimsign.8
5 babf5d5a 2021-05-11 martijn BINDIR= ${LOCALBASE}/libexec/opensmtpd/
6 babf5d5a 2021-05-11 martijn MANDIR= ${LOCALBASE}/share/man/man8
8 babf5d5a 2021-05-11 martijn BINOWN?= root
9 babf5d5a 2021-05-11 martijn BINGRP?= root
10 babf5d5a 2021-05-11 martijn BINPERM?= 755
12 babf5d5a 2021-05-11 martijn SRCS+= main.c mheader.c
14 babf5d5a 2021-05-11 martijn CFLAGS+=-I${LOCALBASE}/include
15 babf5d5a 2021-05-11 martijn CFLAGS+=-Wall -I${.CURDIR}
16 babf5d5a 2021-05-11 martijn CFLAGS+=-Wstrict-prototypes -Wmissing-prototypes
17 babf5d5a 2021-05-11 martijn CFLAGS+=-Wmissing-declarations
18 babf5d5a 2021-05-11 martijn CFLAGS+=-Wshadow -Wpointer-arith -Wcast-qual
19 babf5d5a 2021-05-11 martijn CFLAGS+=-Wsign-compare
20 babf5d5a 2021-05-11 martijn CFLAGS+=-I${CURDIR} -I${CURDIR}/openbsd-compat/
22 babf5d5a 2021-05-11 martijn LDFLAGS+=-L${LOCALBASE}/lib
23 babf5d5a 2021-05-11 martijn LDLIBS+=-lcrypto -lopensmtpd
25 babf5d5a 2021-05-11 martijn INSTALL?= install
27 babf5d5a 2021-05-11 martijn NEED_RECALLOCARRAY?= 1
28 babf5d5a 2021-05-11 martijn NEED_STRLCAT?= 1
29 babf5d5a 2021-05-11 martijn NEED_STRTONUM?= 1
30 babf5d5a 2021-05-11 martijn NEED_PLEDGE?= 1
32 babf5d5a 2021-05-11 martijn .PHONY: all
33 babf5d5a 2021-05-11 martijn all: ${PROG}
35 babf5d5a 2021-05-11 martijn ifeq (${NEED_RECALLOCARRAY}, 1)
36 babf5d5a 2021-05-11 martijn SRCS+= ${CURDIR}/openbsd-compat/recallocarray.c
37 babf5d5a 2021-05-11 martijn CFLAGS+= -DNEED_RECALLOCARRAY=1
39 babf5d5a 2021-05-11 martijn recallocarray.o: ${CURDIR}/openbsd-compat/recallocarray.c
40 babf5d5a 2021-05-11 martijn ${CC} ${CFLAGS} -c -o recallocarray.o ${CURDIR}/openbsd-compat/recallocarray.c
42 babf5d5a 2021-05-11 martijn ifeq (${NEED_STRLCAT}, 1)
43 babf5d5a 2021-05-11 martijn SRCS+= ${CURDIR}/openbsd-compat/strlcat.c
44 babf5d5a 2021-05-11 martijn CFLAGS+= -DNEED_STRLCAT=1
46 babf5d5a 2021-05-11 martijn strlcat.o: ${CURDIR}/openbsd-compat/strlcat.c
47 babf5d5a 2021-05-11 martijn ${CC} ${CFLAGS} -c -o strlcat.o ${CURDIR}/openbsd-compat/strlcat.c
49 babf5d5a 2021-05-11 martijn ifeq (${NEED_STRTONUM}, 1)
50 babf5d5a 2021-05-11 martijn SRCS+= ${CURDIR}/openbsd-compat/strtonum.c
51 babf5d5a 2021-05-11 martijn CFLAGS+= -DNEED_STRTONUM=1
53 babf5d5a 2021-05-11 martijn strtonum.o: ${CURDIR}/openbsd-compat/strtonum.c
54 babf5d5a 2021-05-11 martijn ${CC} ${CFLAGS} -c -o strtonum.o ${CURDIR}/openbsd-compat/strtonum.c
56 babf5d5a 2021-05-11 martijn ifeq (${NEED_PLEDGE}, 1)
57 babf5d5a 2021-05-11 martijn CFLAGS+= -DNEED_PLEDGE=1
60 babf5d5a 2021-05-11 martijn ${SRCS:.c=.d}:%.d:%.c
61 babf5d5a 2021-05-11 martijn ${CC} ${CFLAGS} -MM $< >$@
63 babf5d5a 2021-05-11 martijn OBJS= ${notdir ${SRCS:.c=.o}}
65 babf5d5a 2021-05-11 martijn ${PROG}: ${OBJS}
66 babf5d5a 2021-05-11 martijn ${CC} ${LDFLAGS} -o $@ $^ ${LDLIBS}
68 babf5d5a 2021-05-11 martijn .PHONY: clean
70 babf5d5a 2021-05-11 martijn rm -f *.d *.o ${PROG}
72 babf5d5a 2021-05-11 martijn .PHONY: install
73 babf5d5a 2021-05-11 martijn install: ${PROG}
74 babf5d5a 2021-05-11 martijn ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINPERM} ${PROG} ${BINDIR}