-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.gnu
More file actions
66 lines (52 loc) · 1.34 KB
/
Makefile.gnu
File metadata and controls
66 lines (52 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
LOCALBASE?= /usr/
PROG= filter-sshglogger
MAN= filter-sshglogger.8
BINDIR= ${LOCALBASE}/libexec/opensmtpd/
MANDIR= ${LOCALBASE}/share/man/man8
SRCS+= main.c
CFLAGS+= -I${LOCALBASE}/include
CFLAGS+= -DPROG=${PROG}
CFLAGS+= -Wall -I${.CURDIR}
CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+= -Wmissing-declarations
CFLAGS+= -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS+= -Wsign-compare
CFLAGS+= ${CRYPT_CFLAGS}
CFLAGS+= -I${CURDIR}
LDFLAGS+= -L${LOCALBASE}/lib
LDFLAGS+= ${CRYPT_LDFLAGS}
LDADD+= ${CRYPT_LDADD} -lopensmtpd
INSTALL?= install
MANFORMAT?= mangz
BINOWN?= root
BINGRP?= root
BINPERM?= 755
MANOWN?= root
MANGRP?= root
MANPERM?= 644
ifeq (${MANFORMAT}, mangz)
TARGET_MAN= ${MAN}.gz
CLEANFILES+= ${TARGET_MAN}
${TARGET_MAN}: ${MAN}
mandoc -Tman ${MAN} | gzip > $@
else
TARGET_MAN= ${MAN}
endif
${SRCS:.c=.d}:%.d:%.c
${CC} ${CFLAGS} -MM $< >$@
CLEANFILES+= ${SRCS:.c=.d}
OBJS= ${notdir ${SRCS:.c=.o}}
CLEANFILES+= ${OBJS}
${PROG}: ${OBJS}
${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
.DEFAULT_GOAL= all
.PHONY: all
all: ${PROG} ${TARGET_MAN}
CLEANFILES+= ${PROG}
.PHONY: clean
clean:
rm -f ${CLEANFILES}
.PHONY: install
install: ${PROG}
${INSTALL} -D -o ${BINOWN} -g ${BINGRP} -m ${BINPERM} ${PROG} ${DESTDIR}${BINDIR}/${PROG}
${INSTALL} -D -o ${MANOWN} -g ${MANGRP} -m ${MANPERM} ${TARGET_MAN} ${DESTDIR}${MANDIR}/${TARGET_MAN}