1 # Makefile for fetchmail
3 # If you're running QNX, we can't assume a working autoconf.
4 # So just uncomment all the lines marked QNX.
8 # Ultrix 2.2 make doesn't expand the value of VPATH.
16 # CFLAGS = -g2 -5 # QNX
18 # LDLAGS = -g2 -5 # QNX
25 # How to invoke ranlib. This is only used by the `glob' subdirectory.
28 # NeXT 1.0a uses an old version of GCC, which required -D__inline=inline.
29 # See also `config.h'.
30 DEFS = @DEFS@ @EXTRADEFS@
31 # DEFS = -DQNX -DHAVE_CONFIG_H -DHAVE_UNISTD_H -DHAVE_STDARG_H -DSTDC_HEADERS # QNX
32 defines = -DRELEASE_ID=\"$(VERS)\" $(DEFS)
34 # If your system needs extra libraries loaded in, define them here.
35 LOADLIBS = @LIBS@ @LEXLIB@
36 # LOADLIBS = -lsocket3r -lunix3r # QNX
38 # Any extra object files your system needs.
41 # Extra sources/objects for library functions not provided on the host system.
43 # EXTRASRC = $(srcdir)/strcasecmp.c $(srcdir)/getopt.c $(srcdir)/getopt1.c $(srcdir)/alloca.c # QNX
45 # EXTRAOBJ = strcasecmp.o getopt.o getopt1.o alloca.o
47 # Common prefix for machine-independent installed files.
49 # Common prefix for machine-dependent installed files.
50 exec_prefix = @exec_prefix@
52 # Name under which to install fetchmail
54 # Directory in which to install.
56 # Directory to install the Info files in.
58 # Number to put on the man page filename.
60 # Directory to install the man page in.
61 mandir = @mandir@/man$(manext)
63 # Program to install `make'.
64 INSTALL_PROGRAM = @INSTALL_PROGRAM@
65 # Program to install the man page.
66 INSTALL_DATA = @INSTALL_DATA@
67 # Generic install program.
70 # Program to format Texinfo source into Info files.
72 # Program to format Texinfo source into DVI files.
75 # Programs to make tags files.
79 protobjs = rcfile_y.o rcfile_l.o socket.o getpass.o pop2.o pop3.o imap.o \
80 etrn.o fetchmail.o env.o options.o daemon.o driver.o rfc822.o smtp.o \
81 xmalloc.o uid.o mxget.o md5c.o md5ify.o interface.o netrc.o base64.o \
84 objs = $(protobjs) $(extras) $(EXTRAOBJ)
86 srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c \
87 $(srcdir)/pop3.c $(srcdir)/imap.c $(srcdir)/etrn.c \
88 $(srcdir)/fetchmail.c $(srcdir)/env.c \
89 $(srcdir)/options.c $(srcdir)/daemon.c \
90 $(srcdir)/driver.c $(srcdir)/rfc822.c $(srcdir)/smtp.c \
91 $(srcdir)/xmalloc.c $(srcdir)/uid.c $(srcdir)/mxget.c \
92 $(srcdir)/md5c.c $(srcdir)/md5ify.c $(srcdir)/interface.c \
93 $(srcdir)/netrc.c $(srcdir)/base64.c $(srcdir)/error.c
96 .SUFFIXES: .o .c .h .y .l .ps .dvi .info .texi
100 # Some makes apparently use .PHONY as the default goal if it is before `all'.
104 $(CC) $(LDFLAGS) $(objs) $(LOADLIBS) -o fetchmail
106 # Tester for address parsing
108 gcc -DTESTMAIN -g rfc822.c -o rfc822
111 $(CC) $(defines) -c -I$(srcdir) -I. $(CFLAGS) $<
113 # For some losing Unix makes.
117 tagsrcs = $(srcs) rcfile_l.c rcfile_y.c
123 .PHONY: install installdirs uninstall
124 install: installdirs $(bindir)/$(instname) $(mandir)/$(instname).$(manext)
127 $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(mandir)
129 $(bindir)/$(instname): fetchmail
130 $(INSTALL_PROGRAM) fetchmail $@
132 $(mandir)/$(instname).$(manext): fetchmail.man
133 $(INSTALL_DATA) $(srcdir)/fetchmail.man $@
136 rm -f $(bindir)/$(instname) $(mandir)/$(instname).$(manext)
138 .PHONY: clean realclean distclean mostlyclean
140 -rm -f fetchmail *.o core fetchmail.dvi \
141 rcfile_l.c rcfile_y.h rcfile_y.c \
142 fetchmail.tar fetchmail.tar.gz \
146 -rm -f Makefile config.h TAGS tags
147 -rm -f config.cache config.status config.log stamp-config
150 -rm -f FAQ FEATURES NOTES MANIFEST
151 -rm -f config.cache config.log configure Makefile
152 -rm -f fetchmail-*.tar.gz fetchmail-*.rpm
156 config.status: configure
159 config.h: config.status config.h.in
160 sh config.status; touch config.h
162 Makefile: config.status Makefile.in
165 configure: configure.in
168 config.h.in: acconfig.h configure.in
169 autoheader $(ACFLAGS); touch config.h.in
171 # This tells versions [3.59,3.63) of GNU make not to export all variables.
174 # Special dependencies, not easily handled portably without explicit rules
175 rcfile_l.c rcfile_l.h: $(srcdir)/rcfile_l.l
176 $(LEX) $(LEXFLAGS) $(srcdir)/rcfile_l.l
177 mv lex.yy.c rcfile_l.c
178 rcfile_y.c rcfile_y.h: $(srcdir)/rcfile_y.y
179 @echo "expect conflicts: 2 shift/reduce"
180 $(YACC) $(YACCFLAGS) $(srcdir)/rcfile_y.y
181 mv y.tab.c rcfile_y.c
182 mv -f y.tab.h rcfile_y.h
184 # These must be explicit, because the .c files often don't exist at
185 # makefile build time.
186 rcfile_l.o: rcfile_y.c rcfile_y.h config.h fetchmail.h
187 rcfile_y.o: rcfile_y.c rcfile_y.h config.h fetchmail.h
189 parser = $(srcdir)/rcfile_l.l $(srcdir)/rcfile_y.y
190 headers = $(srcdir)/fetchmail.h $(srcdir)/socket.h $(srcdir)/smtp.h \
191 $(srcdir)/mx.h $(srcdir)/md5.h $(srcdir)/md5global.h \
192 $(srcdir)/netrc.h $(srcdir)/tunable.h
193 extra = $(srcdir)/alloca.c $(srcdir)/getopt.[ch] $(srcdir)/getopt1.c \
194 $(srcdir)/strcasecmp.c $(srcdir)/strstr.c
195 docs = $(srcdir)/COPYING $(srcdir)/FEATURES $(srcdir)/fetchmail-features.html \
196 $(srcdir)/design-notes.html $(srcdir)/NOTES \
197 $(srcdir)/INSTALL $(srcdir)/NEWS $(srcdir)/README \
198 $(srcdir)/fetchmail.lsm $(srcdir)/sample.rcfile \
199 $(srcdir)/*.man $(srcdir)/FAQ $(srcdir)/fetchmail-FAQ.html
200 config = $(srcdir)/Makefile.in $(srcdir)/configure.in $(srcdir)/configure \
201 $(srcdir)/config.guess $(srcdir)/config.h.in $(srcdir)/config.sub \
203 scripts = $(srcdir)/install.sh $(srcdir)/mkinstalldirs \
204 $(srcdir)/specgen.sh $(srcdir)/lsmgen.sh
205 all = $(docs) $(config) $(srcs) $(parser) $(headers) $(extra) $(scripts) \
206 $(srcdir)/contrib/*[A-Za-uw-z] $(srcdir)/MANIFEST $(srcdir)/LIBOPIE.PATCH
208 MANIFEST: $(srcdir) Makefile.in
209 @echo $(all) | tr "[ \t]" '\n' | sed -e '/^\.\//s///' | sort >MANIFEST
212 FAQ: fetchmail-FAQ.html
213 echo " (This document was generated from fetchmail-FAQ.html)" >FAQ
214 lynx -dump -nolist fetchmail-FAQ.html >>FAQ
216 FEATURES: fetchmail-features.html
217 echo " (This document was generated from fetchmail-features.html)" >FEATURES
218 lynx -dump -nolist fetchmail-features.html | grep -v "Back to " >>FEATURES
220 NOTES: design-notes.html
221 echo " (This document was generated from design-notes.html)" >NOTES
222 lynx -dump -nolist design-notes.html | grep -v "Back to " >NOTES
224 # Make distribution, update LSM with proper size, remake distribution
226 rm -f MANIFEST; make MANIFEST;
227 make fetchmail-$(VERS).tar.gz
228 lsmgen.sh $(VERS) `wc -c fetchmail-$(VERS).tar.gz` >fetchmail.lsm
229 make fetchmail-$(VERS).tar.gz
230 ls -l fetchmail-$(VERS).tar.gz
231 @echo "Don't forget to build RPMs from root!"
233 # This requires my patch to tar-1.12, or a stock tar-1.13 (not yet released);
234 # the version must implement the --name-prefix option.
235 fetchmail-$(VERS).tar.gz: $(all)
236 tar --name-prefix='fetchmail-$(VERS)/' -czf fetchmail-$(VERS).tar.gz `cat MANIFEST`
238 # Make RPMs. You need to be root to make this work
239 RPMROOT=/usr/src/redhat
243 cp fetchmail-$(VERS).tar.gz $(RPMROOT)/SOURCES;
244 $(srcdir)/specgen.sh $(VERS) >$(RPMROOT)/SPECS/fetchmail.spec
245 cd $(RPMROOT)/SPECS; $(RPM) $(RPMFLAGS) fetchmail.spec
246 cp $(RPMROOT)/RPMS/`arch|sed 's/i[4-9]86/i386/'`/fetchmail-$(VERS)*.rpm $(srcdir)
247 cp $(RPMROOT)/SRPMS/fetchmail-$(VERS)*.src.rpm $(srcdir)
249 # Automatically generated dependencies will be put at the end of the makefile.