File: Makefile

package info (click to toggle)
fdm 1.6-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,612 kB
  • ctags: 1,526
  • sloc: ansic: 14,941; yacc: 1,976; sh: 540; makefile: 245; awk: 146
file content (178 lines) | stat: -rw-r--r-- 4,887 bytes parent folder | download
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# $Id: Makefile,v 1.176 2008/12/22 16:20:05 nicm Exp $

.SUFFIXES: .c .o .y .h
.PHONY: clean lint regress yannotate manual \
	update-index.html upload-index.html

PROG= fdm
VERSION= 1.6

OS!= uname
REL!= uname -r
DATE!= date +%Y%m%d-%H%M

# This must be empty as OpenBSD includes it in default CFLAGS.
#DEBUG=

SRCS= fdm.c \
      attach.c buffer.c cleanup.c command.c connect.c io.c log.c netrc.c \
      child-deliver.c child-fetch.c child.c \
      pcre.c re.c privsep.c replace.c shm-mmap.c strb.c db-tdb.c \
      xmalloc-debug.c xmalloc.c timer.c \
      deliver-add-header.c deliver-drop.c deliver-keep.c deliver-maildir.c \
      deliver-mbox.c deliver-pipe.c deliver-remove-header.c deliver-rewrite.c \
      deliver-smtp.c deliver-stdout.c deliver-tag.c deliver-add-to-cache.c \
      deliver-remove-from-cache.c deliver-write.c deliver-imap.c \
      fetch-imap.c fetch-imappipe.c fetch-maildir.c fetch-nntp.c fetch-pop3.c \
      fetch-pop3pipe.c fetch-stdin.c fetch-mbox.c pop3-common.c imap-common.c \
      mail-state.c mail-time.c mail.c file.c cache-op.c \
      match-all.c match-age.c match-attachment.c match-command.c \
      match-in-cache.c match-matched.c match-regexp.c match-size.c \
      match-string.c match-tagged.c match-unmatched.c match-account.c \
      parent-deliver.c parent-fetch.c \
      lookup.c lookup-passwd.c lookup-courier.c \
      parse.y parse-fn.c lex.c
HDRS= fdm.h array.h fetch.h match.h deliver.h

YACC= yacc -d

CC?= cc
INCDIRS+= -I. -I- -I/usr/local/include
.ifdef PROFILE
# Don't use ccache
CC= /usr/bin/gcc
CFLAGS+= -pg -DPROFILE -fprofile-arcs -ftest-coverage -O0
.endif
.ifdef DEBUG
CFLAGS+= -g -ggdb -DDEBUG
LDFLAGS+= -Wl,-E
CFLAGS+= -DBUILD="\"$(VERSION) ($(DATE))\""
.else
CFLAGS+= -DBUILD="\"$(VERSION)\""
.endif
#CFLAGS+= -pedantic -std=c99
CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wcast-qual -Wsign-compare
CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align

.ifdef COURIER
CFLAGS+= -DLOOKUP_COURIER
LIBS+= -lcourierauth
.endif

.ifdef PCRE
CFLAGS+= -DPCRE
LIBS+= -lpcre
.endif

# OS X
.if ${OS} == "Darwin"
SRCS+= compat/strtonum.c
INCDIRS+= -Icompat -I/usr/local/include/openssl
CFLAGS+= -DNO_STRTONUM -DNO_SETRESUID -DNO_SETRESGID -DNO_SETPROCTITLE
.endif

# NetBSD
.if ${OS} == "NetBSD"
SRCS+= compat/strtonum.c
INCDIRS+= -Icompat -I/usr/pkg/include
CFLAGS+= -DNO_STRTONUM -DNO_SETRESUID -DNO_SETRESGID
LDFLAGS+= -L/usr/pkg/lib
.endif

# FreeBSD
.if ${OS} == "FreeBSD"
INCDIRS+= -Icompat -I/usr/include/openssl

# FreeBSD 5
.if ${REL:R} == 5
SRCS+= compat/strtonum.c
CFLAGS+= -DNO_STRTONUM
.endif
.endif

PREFIX?= /usr/local
INSTALLDIR= install -d
INSTALLBIN= install -g bin -o root -m 555
INSTALLMAN= install -g bin -o root -m 444

LDFLAGS+= -L/usr/local/lib
.ifdef PROFILE
LDFLAGS+= -pg
.endif
LIBS+= -lssl -lcrypto -ltdb -lz

OBJS= ${SRCS:S/.c/.o/:S/.y/.o/}

DISTDIR= ${PROG}-${VERSION}
DISTFILES= *.[chyl] Makefile GNUmakefile *.[1-9] fdm-sanitize \
	   README MANUAL TODO CHANGES \
	   `find examples compat regress -type f -and ! -path '*CVS*'`

CLEANFILES= ${PROG} *.o compat/*.o y.tab.c y.tab.h .depend \
	    ${DISTDIR}.tar.gz *~ */*~ *.ln ${PROG}.core MANUAL index.html

.c.o:
		${CC} ${CFLAGS} ${INCDIRS} -c ${.IMPSRC} -o ${.TARGET}

.y.o:
		${YACC} ${.IMPSRC}
		${CC} ${CFLAGS} ${INCDIRS} -c y.tab.c -o ${.TARGET}

all:		${PROG}

${PROG}:	${OBJS}
		${CC} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}

dist:		clean manual
		grep '^#DEBUG=' Makefile
		grep '^#DEBUG=' GNUmakefile
		[ "`(grep '^VERSION' Makefile; grep '^VERSION' GNUmakefile)| \
			uniq -u`" = "" ]
		tar -zc \
			-s '/.*/${DISTDIR}\/\0/' \
			-f ${DISTDIR}.tar.gz ${DISTFILES}

lint:
		lint -cehvx ${CFLAGS:M-D*} ${SRCS:M*.c}

depend:
		mkdep ${CFLAGS} ${INCDIRS} ${SRCS:M*.c}

regress:	${PROG}
		cd regress && ${MAKE}

yannotate:
		awk -f yannotate.awk parse.y > parse.y.new
		mv parse.y.new parse.y
		trim parse.y

upload-index.html:
		scp index.html nicm@shell.sf.net:index.html
		ssh nicm@shell.sf.net sh update-index-fdm.sh

update-index.html: manual
		nroff -mdoc fdm.conf.5|m2h -u > fdm.conf.5.html
		nroff -mdoc fdm.1|m2h -u > fdm.1.html
		awk -v V=${VERSION} -f makeindex.awk index.html.in > index.html
		rm -f fdm.conf.5.html fdm.1.html

manual:
		awk -f makemanual.awk MANUAL.in > MANUAL

install:	all
		${INSTALLDIR} ${DESTDIR}${PREFIX}/bin
		${INSTALLBIN} ${PROG} ${DESTDIR}${PREFIX}/bin/${PROG}
		${INSTALLDIR} ${DESTDIR}${PREFIX}/man/man1
		${INSTALLMAN} ${PROG}.1 ${DESTDIR}${PREFIX}/man/man1/
		${INSTALLDIR} ${DESTDIR}${PREFIX}/man/man5
		${INSTALLMAN} ${PROG}.conf.5 ${DESTDIR}${PREFIX}/man/man5/

uninstall:
		rm -f ${DESTDIR}${PREFIX}/bin/${PROG}
		rm -f ${DESTDIR}${PREFIX}/man/man1/${PROG}.1
		rm -f ${DESTDIR}${PREFIX}/man/man5/${PROG}.conf.5

clean:
		rm -f ${CLEANFILES}