1 # Makefile for rsync. This is processed by configure to produce the final
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
26 VERSION=@RSYNC_VERSION@
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 \
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@
48 TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
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)
54 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
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
59 # note that the -I. is needed to handle config.h when using VPATH
62 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
65 all: Makefile rsync$(EXEEXT) rsync-ssl stunnel-rsync stunnel-rsyncd.conf @MAKE_MAN@
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
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}
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"; \
87 install-all: install install-ssl-client install-ssl-daemon
90 $(MAKE) INSTALL_STRIP='-s' install
92 rsync$(EXEEXT): $(OBJS)
93 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
96 $(CHECK_OBJS): $(HEADERS)
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; \
111 @if test -f rounding.h; then : ; else \
112 cat rounding.out 1>&2; \
113 echo "Failed to create rounding.h!" 1>&2; \
118 tls$(EXEEXT): $(TLS_OBJ)
119 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
121 testrun$(EXEEXT): testrun.o
122 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
124 getgroups$(EXEEXT): getgroups.o
125 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
127 getfsdev$(EXEEXT): getfsdev.o
128 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
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)
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)
138 gen: conf proto.h man
141 rsync -aivzc $(GENFILES) samba.org:/home/ftp/pub/rsync/generated-files/
144 cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
146 aclocal.m4: acinclude.m4
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; \
158 echo "configure.sh has CHANGED."; \
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; \
164 echo "config.h.in has CHANGED."; \
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".'; \
170 echo 'You may need to run:'; \
171 echo ' make reconfigure'; \
176 reconfigure: configure.sh
177 ./config.status --recheck
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
183 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
184 echo "Makefile is unchanged."; \
187 if test "$(MAKECMDGOALS)" = reconfigure; then \
188 echo 'Continuing with "make reconfigure".'; \
190 echo "Makefile updated -- rerun your make command."; \
195 rsync-ssl: $(srcdir)/rsync-ssl.in Makefile
196 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/rsync-ssl.in >rsync-ssl
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
203 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
204 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
206 proto: proto.h-tstamp
208 proto.h: proto.h-tstamp
209 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
211 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
212 perl $(srcdir)/mkproto.pl $(srcdir)/*.c $(srcdir)/lib/compat.c
214 man: rsync.1 rsyncd.conf.5 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
221 yodl2man -o rsync.1 $(srcdir)/rsync.yo
222 -$(srcdir)/tweak_manpage rsync.1
224 rsyncd.conf.5: rsyncd.conf.yo
225 yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
226 -$(srcdir)/tweak_manpage rsyncd.conf.5
229 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
230 rounding rounding.h *.old
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.
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
248 rm -rf autom4te.cache
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)
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
258 # 'check' is the GNU name, 'test' is the name for everybody else :-)
263 # There seems to be no standard way to specify some variables as
264 # exported from a Makefile apart from listing them like this.
266 # This depends on building rsync; if we need any helper programs it
267 # should depend on them too.
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.
273 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
274 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
276 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
277 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
279 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
280 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
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)
286 testsuite/chown-fake.test:
287 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
289 testsuite/devices-fake.test:
290 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
292 testsuite/xattrs-hlink.test:
293 ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
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,
299 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
300 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
302 # TODO: Add 'dist' target; need to know which files will be included
304 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
307 splint +unixlib +gnuextensions -weak rsync.c
310 rsync.dvi: doc/rsync.texinfo
316 rsync.pdf: doc/rsync.texinfo
317 texi2dvi -o $@ --pdf $<
321 cd $(srcdir) && rm dox/html/* && doxygen
323 # for maintainers only
325 rsync -avzv $(srcdir)/dox/html/ --delete \
326 samba.org:/home/httpd/html/rsync/doxygen/head/