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