Blame


1 cb6053ee 2021-05-11 martijn LOCALBASE?= /usr/local/
2 cb6053ee 2021-05-11 martijn
3 cb6053ee 2021-05-11 martijn PROG= filter-admdscrub
4 cb6053ee 2021-05-11 martijn MAN= filter-admdscrub.8
5 cb6053ee 2021-05-11 martijn BINDIR= ${LOCALBASE}/libexec/opensmtpd/
6 cb6053ee 2021-05-11 martijn MANDIR= ${LOCALBASE}/share/man/man8
7 cb6053ee 2021-05-11 martijn
8 cb6053ee 2021-05-11 martijn BINOWN?= root
9 cb6053ee 2021-05-11 martijn BINGRP?= root
10 cb6053ee 2021-05-11 martijn BINPERM?= 755
11 cb6053ee 2021-05-11 martijn
12 cb6053ee 2021-05-11 martijn SRCS+= main.c mheader.c
13 cb6053ee 2021-05-11 martijn
14 cb6053ee 2021-05-11 martijn CFLAGS+=-I${LOCALBASE}/include
15 cb6053ee 2021-05-11 martijn CFLAGS+=-Wall -I${.CURDIR}
16 cb6053ee 2021-05-11 martijn CFLAGS+=-Wstrict-prototypes -Wmissing-prototypes
17 cb6053ee 2021-05-11 martijn CFLAGS+=-Wmissing-declarations
18 cb6053ee 2021-05-11 martijn CFLAGS+=-Wshadow -Wpointer-arith -Wcast-qual
19 cb6053ee 2021-05-11 martijn CFLAGS+=-Wsign-compare
20 cb6053ee 2021-05-11 martijn CFLAGS+=-I${CURDIR} -I${CURDIR}/openbsd-compat/
21 cb6053ee 2021-05-11 martijn
22 cb6053ee 2021-05-11 martijn LDFLAGS+=-L${LOCALBASE}/lib
23 cb6053ee 2021-05-11 martijn LDLIBS+=-levent -lopensmtpd
24 cb6053ee 2021-05-11 martijn
25 cb6053ee 2021-05-11 martijn INSTALL?= install
26 cb6053ee 2021-05-11 martijn
27 cb6053ee 2021-05-11 martijn NEED_STRLCAT?= 1
28 cb6053ee 2021-05-11 martijn NEED_PLEDGE?= 1
29 cb6053ee 2021-05-11 martijn
30 cb6053ee 2021-05-11 martijn .PHONY: all
31 cb6053ee 2021-05-11 martijn all: ${PROG}
32 cb6053ee 2021-05-11 martijn
33 cb6053ee 2021-05-11 martijn ifeq (${NEED_STRLCAT}, 1)
34 cb6053ee 2021-05-11 martijn SRCS+= ${CURDIR}/openbsd-compat/strlcat.c
35 cb6053ee 2021-05-11 martijn CFLAGS+= -DNEED_STRLCAT=1
36 cb6053ee 2021-05-11 martijn
37 cb6053ee 2021-05-11 martijn strlcat.o: ${CURDIR}/openbsd-compat/strlcat.c
38 cb6053ee 2021-05-11 martijn ${CC} ${CFLAGS} -c -o strlcat.o ${CURDIR}/openbsd-compat/strlcat.c
39 cb6053ee 2021-05-11 martijn endif
40 cb6053ee 2021-05-11 martijn ifeq (${NEED_PLEDGE}, 1)
41 cb6053ee 2021-05-11 martijn CFLAGS+= -DNEED_PLEDGE=1
42 cb6053ee 2021-05-11 martijn endif
43 cb6053ee 2021-05-11 martijn
44 cb6053ee 2021-05-11 martijn ${SRCS:.c=.d}:%.d:%.c
45 cb6053ee 2021-05-11 martijn ${CC} ${CFLAGS} -MM $< >$@
46 cb6053ee 2021-05-11 martijn
47 cb6053ee 2021-05-11 martijn OBJS= ${notdir ${SRCS:.c=.o}}
48 cb6053ee 2021-05-11 martijn
49 cb6053ee 2021-05-11 martijn ${PROG}: ${OBJS}
50 cb6053ee 2021-05-11 martijn ${CC} ${LDFLAGS} -o $@ $^ ${LDLIBS}
51 cb6053ee 2021-05-11 martijn
52 cb6053ee 2021-05-11 martijn .PHONY: clean
53 cb6053ee 2021-05-11 martijn clean:
54 cb6053ee 2021-05-11 martijn rm -f *.d *.o ${PROG}
55 cb6053ee 2021-05-11 martijn
56 cb6053ee 2021-05-11 martijn .PHONY: install
57 cb6053ee 2021-05-11 martijn install: ${PROG}
58 cb6053ee 2021-05-11 martijn ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINPERM} ${PROG} ${BINDIR}