1 # Makefile for rsync. This is processed by configure to produce the final
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
27 VERSION=@RSYNC_VERSION@
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 \
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@
49 TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
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)
55 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
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
60 # note that the -I. is needed to handle config.h when using VPATH
63 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
66 all: Makefile rsync$(EXEEXT) rsync-ssl stunnel-rsync stunnel-rsyncd.conf @MAKE_MAN@
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
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}
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"; \
88 install-all: install install-ssl-client install-ssl-daemon
91 $(MAKE) INSTALL_STRIP='-s' install
93 rsync$(EXEEXT): $(OBJS)
94 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
97 $(CHECK_OBJS): $(HEADERS)
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; \
112 @if test -f rounding.h; then : ; else \
113 cat rounding.out 1>&2; \
114 echo "Failed to create rounding.h!" 1>&2; \
119 tls$(EXEEXT): $(TLS_OBJ)
120 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
122 testrun$(EXEEXT): testrun.o
123 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
125 getgroups$(EXEEXT): getgroups.o
126 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
128 getfsdev$(EXEEXT): getfsdev.o
129 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
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)
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)
139 gen: conf proto.h man
142 rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
145 cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
147 aclocal.m4: $(srcdir)/m4/*.m4
148 aclocal -I $(srcdir)/m4
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; \
159 echo "configure.sh has CHANGED."; \
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; \
165 echo "config.h.in has CHANGED."; \
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".'; \
171 echo 'You may need to run:'; \
172 echo ' make reconfigure'; \
177 reconfigure: configure.sh
178 ./config.status --recheck
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
184 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
185 echo "Makefile is unchanged."; \
188 if test "$(MAKECMDGOALS)" = reconfigure; then \
189 echo 'Continuing with "make reconfigure".'; \
191 echo "Makefile updated -- rerun your make command."; \
196 rsync-ssl: $(srcdir)/rsync-ssl.in Makefile
197 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/rsync-ssl.in >rsync-ssl
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
204 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
205 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
207 proto: proto.h-tstamp
209 proto.h: proto.h-tstamp
210 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
212 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
213 perl $(srcdir)/mkproto.pl $(srcdir)/*.c $(srcdir)/lib/compat.c
215 man: rsync.1 rsyncd.conf.5 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
222 yodl2man -o rsync.1 $(srcdir)/rsync.yo
223 -$(srcdir)/tweak_manpage rsync.1
225 rsyncd.conf.5: rsyncd.conf.yo
226 yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
227 -$(srcdir)/tweak_manpage rsyncd.conf.5
230 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
231 rounding rounding.h *.old
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.
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
249 rm -rf autom4te.cache
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)
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
259 # 'check' is the GNU name, 'test' is the name for everybody else :-)
264 # There seems to be no standard way to specify some variables as
265 # exported from a Makefile apart from listing them like this.
267 # This depends on building rsync; if we need any helper programs it
268 # should depend on them too.
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.
274 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
275 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
277 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
278 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
280 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
281 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
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)
287 testsuite/chown-fake.test:
288 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
290 testsuite/devices-fake.test:
291 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
293 testsuite/xattrs-hlink.test:
294 ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
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,
300 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
301 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
303 # TODO: Add 'dist' target; need to know which files will be included
305 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
308 splint +unixlib +gnuextensions -weak rsync.c
311 cd $(srcdir) && rm dox/html/* && doxygen
313 # for maintainers only
315 rsync -avzv $(srcdir)/dox/html/ --delete \
316 $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/