Rename aclocal.m4 to acinclude.m4 and add make target
[rsync.git] / Makefile.in
1 # Makefile for rsync. This is processed by configure to produce the final
2 # Makefile
3
4 prefix=@prefix@
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
7 stunnel4=@STUNNEL4@
8 bindir=@bindir@
9 mandir=@mandir@
10
11 LIBS=@LIBS@
12 CC=@CC@
13 CFLAGS=@CFLAGS@
14 CPPFLAGS=@CPPFLAGS@
15 EXEEXT=@EXEEXT@
16 LDFLAGS=@LDFLAGS@
17
18 INSTALLCMD=@INSTALL@
19 INSTALLMAN=@INSTALL@
20
21 srcdir=@srcdir@
22 MKDIR_P=@MKDIR_P@
23 VPATH=$(srcdir)
24 SHELL=/bin/sh
25
26 VERSION=@RSYNC_VERSION@
27
28 .SUFFIXES:
29 .SUFFIXES: .c .o
30
31 GENFILES=configure.sh config.h.in proto.h proto.h-tstamp rsync.1 rsyncd.conf.5
32 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
33         lib/pool_alloc.h
34 LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
35         lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@
36 zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
37         zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
38 OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
39         util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
40 OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
41         fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
42 OBJS3=progress.o pipe.o
43 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
44 popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
45         popt/popthelp.o popt/poptparse.o
46 OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
47
48 TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
49
50 # Programs we must have to run the test cases
51 CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
52         testrun$(EXEEXT) trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
53
54 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
55
56 # Objects for CHECK_PROGS to clean
57 CHECK_OBJS=tls.o testrun.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
58
59 # note that the -I. is needed to handle config.h when using VPATH
60 .c.o:
61 @OBJ_SAVE@
62         $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
63 @OBJ_RESTORE@
64
65 all: Makefile rsync$(EXEEXT) rsync-ssl stunnel-rsync stunnel-rsyncd.conf @MAKE_MAN@
66
67 install: all
68         -${MKDIR_P} ${DESTDIR}${bindir}
69         ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
70         -${MKDIR_P} ${DESTDIR}${mandir}/man1
71         -${MKDIR_P} ${DESTDIR}${mandir}/man5
72         if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi
73         if test -f rsyncd.conf.5; then ${INSTALLMAN} -m 644 rsyncd.conf.5 ${DESTDIR}${mandir}/man5; fi
74
75 install-ssl-client: rsync-ssl stunnel-rsync
76         -${MKDIR_P} ${DESTDIR}${bindir}
77         ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir}
78         ${INSTALLCMD} -m 755 stunnel-rsync ${DESTDIR}${bindir}
79
80 install-ssl-daemon: stunnel-rsyncd.conf
81         -${MKDIR_P} ${DESTDIR}/etc/stunnel
82         ${INSTALLCMD} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf
83         @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
84             echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
85         fi
86
87 install-all: install install-ssl-client install-ssl-daemon
88
89 install-strip:
90         $(MAKE) INSTALL_STRIP='-s' install
91
92 rsync$(EXEEXT): $(OBJS)
93         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
94
95 $(OBJS): $(HEADERS)
96 $(CHECK_OBJS): $(HEADERS)
97
98 flist.o: rounding.h
99
100 rounding.h: rounding.c rsync.h
101         @for r in 0 1 3; do \
102             if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
103                 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
104                 if test -f "$$HOME/build_farm/build_test.fns"; then \
105                     echo "EXTRA_ROUNDING is $$r" >&2; \
106                 fi; \
107                 break; \
108             fi; \
109         done
110         @rm -f rounding
111         @if test -f rounding.h; then : ; else \
112             cat rounding.out 1>&2; \
113             echo "Failed to create rounding.h!" 1>&2; \
114             exit 1; \
115         fi
116         @rm -f rounding.out
117
118 tls$(EXEEXT): $(TLS_OBJ)
119         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
120
121 testrun$(EXEEXT): testrun.o
122         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
123
124 getgroups$(EXEEXT): getgroups.o
125         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
126
127 getfsdev$(EXEEXT): getfsdev.o
128         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
129
130 TRIMSLASH_OBJ = trimslash.o syscall.o lib/compat.o lib/snprintf.o
131 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
132         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
133
134 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
135 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
136         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
137
138 gen: conf proto.h man
139
140 gensend: gen
141         rsync -aivzc $(GENFILES) samba.org:/home/ftp/pub/rsync/generated-files/
142
143 conf:
144         cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
145
146 aclocal.m4: acinclude.m4
147         aclocal
148
149 configure.sh config.h.in: configure.ac aclocal.m4
150         @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
151         @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
152         autoconf -o configure.sh
153         autoheader && touch config.h.in
154         @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
155             echo "configure.sh is unchanged."; \
156             rm configure.sh.old; \
157         else \
158             echo "configure.sh has CHANGED."; \
159         fi
160         @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
161             echo "config.h.in is unchanged."; \
162             rm config.h.in.old; \
163         else \
164             echo "config.h.in has CHANGED."; \
165         fi
166         @if test -f configure.sh.old -o -f config.h.in.old; then \
167             if test "$(MAKECMDGOALS)" = reconfigure; then \
168                 echo 'Continuing with "make reconfigure".'; \
169             else \
170                 echo 'You may need to run:'; \
171                 echo '  make reconfigure'; \
172                 exit 1; \
173             fi \
174         fi
175
176 reconfigure: configure.sh
177         ./config.status --recheck
178         ./config.status
179
180 Makefile: Makefile.in config.status configure.sh config.h.in
181         @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
182         @./config.status
183         @if diff Makefile Makefile.old >/dev/null 2>&1; then \
184             echo "Makefile is unchanged."; \
185             rm Makefile.old; \
186         else \
187             if test "$(MAKECMDGOALS)" = reconfigure; then \
188                 echo 'Continuing with "make reconfigure".'; \
189             else \
190                 echo "Makefile updated -- rerun your make command."; \
191                 exit 1; \
192             fi \
193         fi
194
195 rsync-ssl: $(srcdir)/rsync-ssl.in Makefile
196         sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/rsync-ssl.in >rsync-ssl
197         @chmod +x rsync-ssl
198
199 stunnel-rsync: $(srcdir)/stunnel-rsync.in Makefile
200         sed 's;\@stunnel4\@;$(stunnel4);g' <$(srcdir)/stunnel-rsync.in >stunnel-rsync
201         @chmod +x stunnel-rsync
202
203 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
204         sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
205
206 proto: proto.h-tstamp
207
208 proto.h: proto.h-tstamp
209         @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
210
211 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
212         perl $(srcdir)/mkproto.pl $(srcdir)/*.c $(srcdir)/lib/compat.c
213
214 man: rsync.1 rsyncd.conf.5 man-copy
215
216 man-copy:
217         @-if test -f rsync.1; then :; else echo 'Copying srcdir rsync.1'; cp -p $(srcdir)/rsync.1 .; fi
218         @-if test -f rsyncd.conf.5; then :; else echo 'Copying srcdir rsyncd.conf.5'; cp -p $(srcdir)/rsyncd.conf.5 .; fi
219
220 rsync.1: rsync.yo
221         yodl2man -o rsync.1 $(srcdir)/rsync.yo
222         -$(srcdir)/tweak_manpage rsync.1
223
224 rsyncd.conf.5: rsyncd.conf.yo
225         yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
226         -$(srcdir)/tweak_manpage rsyncd.conf.5
227
228 clean: cleantests
229         rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
230                 rounding rounding.h *.old
231
232 cleantests:
233         rm -rf ./testtmp*
234
235 # We try to delete built files from both the source and build
236 # directories, just in case somebody previously configured things in
237 # the source directory.
238 distclean: clean
239         rm -f Makefile config.h config.status
240         rm -f rsync-ssl stunnel-rsync stunnel-rsyncd.conf
241         rm -f lib/dummy popt/dummy zlib/dummy
242         rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
243         rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
244         rm -f config.cache config.log
245         rm -f $(srcdir)/config.cache $(srcdir)/config.log
246         rm -f shconfig $(srcdir)/shconfig
247         rm -f $(GENFILES)
248         rm -rf autom4te.cache
249
250 # this target is really just for my use. It only works on a limited
251 # range of machines and is used to produce a list of potentially
252 # dead (ie. unused) functions in the code. (tridge)
253 finddead:
254         nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
255         nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
256         comm -13 nmused.txt nmfns.txt
257
258 # 'check' is the GNU name, 'test' is the name for everybody else :-)
259 .PHONY: check test
260
261 test: check
262
263 # There seems to be no standard way to specify some variables as
264 # exported from a Makefile apart from listing them like this.
265
266 # This depends on building rsync; if we need any helper programs it
267 # should depend on them too.
268
269 # We try to run the scripts with POSIX mode on, in the hope that will
270 # catch Bash-isms earlier even if we're running on GNU.  Of course, we
271 # might lose in the future where POSIX diverges from old sh.
272
273 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
274         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
275
276 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
277         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
278
279 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
280         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
281
282 wildtest.o: wildtest.c lib/wildmatch.c rsync.h config.h
283 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
284         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
285
286 testsuite/chown-fake.test:
287         ln -s chown.test $(srcdir)/testsuite/chown-fake.test
288
289 testsuite/devices-fake.test:
290         ln -s devices.test $(srcdir)/testsuite/devices-fake.test
291
292 testsuite/xattrs-hlink.test:
293         ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
294
295 # This does *not* depend on building or installing: you can use it to
296 # check a version installed from a binary or some other source tree,
297 # if you want.
298
299 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
300         POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
301
302 # TODO: Add 'dist' target; need to know which files will be included
303
304 # Run the SPLINT (Secure Programming Lint) tool.  <www.splint.org>
305 .PHONY: splint
306 splint:
307         splint +unixlib +gnuextensions -weak rsync.c
308
309
310 rsync.dvi: doc/rsync.texinfo
311         texi2dvi -o $@ $<
312
313 rsync.ps: rsync.dvi
314         dvips -ta4 -o $@ $<
315
316 rsync.pdf: doc/rsync.texinfo
317         texi2dvi -o $@ --pdf $<
318
319
320 doxygen:
321         cd $(srcdir) && rm dox/html/* && doxygen
322
323 # for maintainers only
324 doxygen-upload:
325         rsync -avzv $(srcdir)/dox/html/ --delete \
326         samba.org:/home/httpd/html/rsync/doxygen/head/