1 # Makefile for rsync. This is processed by configure to produce the final
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
29 VERSION=@RSYNC_VERSION@
34 GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsync-ssl.1 rsyncd.conf.5
35 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
37 LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
38 lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@
39 zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
40 zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
41 OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
42 util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
43 OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
44 fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
45 OBJS3=progress.o pipe.o
47 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
48 popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
49 popt/popthelp.o popt/poptparse.o
50 OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(CXXOBJ) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
52 TLS_OBJ = tls.o syscall.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
54 # Programs we must have to run the test cases
55 CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
56 testrun$(EXEEXT) trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
58 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
60 # Objects for CHECK_PROGS to clean
61 CHECK_OBJS=tls.o testrun.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
63 # note that the -I. is needed to handle config.h when using VPATH
66 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
69 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_MAN@
72 -${MKDIR_P} ${DESTDIR}${bindir}
73 ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
74 ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir}
75 ${INSTALLCMD} -m 755 rsync-ssl-rsh ${DESTDIR}${bindir}
76 -${MKDIR_P} ${DESTDIR}${mandir}/man1
77 -${MKDIR_P} ${DESTDIR}${mandir}/man5
78 if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi
79 if test -f rsync-ssl.1; then ${INSTALLMAN} -m 644 rsync-ssl.1 ${DESTDIR}${mandir}/man1; fi
80 if test -f rsyncd.conf.5; then ${INSTALLMAN} -m 644 rsyncd.conf.5 ${DESTDIR}${mandir}/man5; fi
82 install-ssl-daemon: stunnel-rsyncd.conf
83 -${MKDIR_P} ${DESTDIR}/etc/stunnel
84 ${INSTALLCMD} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf
85 @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
86 echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
89 install-all: install install-ssl-client install-ssl-daemon
92 $(MAKE) INSTALL_STRIP='-s' install
94 rsync$(EXEEXT): $(OBJS)
95 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
98 $(CHECK_OBJS): $(HEADERS)
99 options.o: latest-year.h
103 rounding.h: rounding.c rsync.h proto.h
104 @for r in 0 1 3; do \
105 if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
106 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
107 if test -f "$$HOME/build_farm/build_test.fns"; then \
108 echo "EXTRA_ROUNDING is $$r" >&2; \
114 @if test -f rounding.h; then : ; else \
115 cat rounding.out 1>&2; \
116 echo "Failed to create rounding.h!" 1>&2; \
121 checksum_sse2.o: checksum_sse2.cpp
122 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
124 tls$(EXEEXT): $(TLS_OBJ)
125 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
127 testrun$(EXEEXT): testrun.o
128 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
130 getgroups$(EXEEXT): getgroups.o
131 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
133 getfsdev$(EXEEXT): getfsdev.o
134 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
136 TRIMSLASH_OBJ = trimslash.o syscall.o t_stub.o lib/compat.o lib/snprintf.o
137 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
138 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
140 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
141 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
142 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
144 gen: conf proto.h man
147 rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
150 cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
152 aclocal.m4: $(srcdir)/m4/*.m4
153 aclocal -I $(srcdir)/m4
155 configure.sh config.h.in: configure.ac aclocal.m4
156 @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
157 @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
158 autoconf -o configure.sh
159 autoheader && touch config.h.in
160 @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
161 echo "configure.sh is unchanged."; \
162 rm configure.sh.old; \
164 echo "configure.sh has CHANGED."; \
166 @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
167 echo "config.h.in is unchanged."; \
168 rm config.h.in.old; \
170 echo "config.h.in has CHANGED."; \
172 @if test -f configure.sh.old -o -f config.h.in.old; then \
173 if test "$(MAKECMDGOALS)" = reconfigure; then \
174 echo 'Continuing with "make reconfigure".'; \
176 echo 'You may need to run:'; \
177 echo ' make reconfigure'; \
182 reconfigure: configure.sh
183 ./config.status --recheck
186 Makefile: Makefile.in config.status configure.sh config.h.in
187 @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
189 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
190 echo "Makefile is unchanged."; \
193 if test "$(MAKECMDGOALS)" = reconfigure; then \
194 echo 'Continuing with "make reconfigure".'; \
196 echo "Makefile updated -- rerun your make command."; \
201 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
202 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
204 proto: proto.h-tstamp
206 proto.h: proto.h-tstamp
207 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
209 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
210 awk -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c
212 man: rsync.1 rsync-ssl.1 rsyncd.conf.5 man-copy
215 @for fn in rsync.1 rsync-ssl.1 rsyncd.conf.5; do \
216 if test -f $$fn; then \
218 elif test -f $(srcdir)/$$fn; then \
219 echo "Copying srcdir $$fn" ; \
220 cp -p $(srcdir)/$$fn . ; \
222 echo "NOTE: $$fn cannot be created." ; \
227 yodl2man -o rsync.1 $(srcdir)/rsync.yo
228 -$(srcdir)/tweak_manpage rsync.1
230 rsync-ssl.1: rsync-ssl.yo
231 yodl2man -o rsync-ssl.1 $(srcdir)/rsync-ssl.yo
232 -$(srcdir)/tweak_manpage rsync-ssl.1
234 rsyncd.conf.5: rsyncd.conf.yo
235 yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
236 -$(srcdir)/tweak_manpage rsyncd.conf.5
239 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
240 rounding rounding.h *.old
245 # We try to delete built files from both the source and build
246 # directories, just in case somebody previously configured things in
247 # the source directory.
249 rm -f Makefile config.h config.status
250 rm -f stunnel-rsyncd.conf
251 rm -f lib/dummy popt/dummy zlib/dummy
252 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
253 rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
254 rm -f config.cache config.log
255 rm -f $(srcdir)/config.cache $(srcdir)/config.log
256 rm -f shconfig $(srcdir)/shconfig
258 rm -rf autom4te.cache
260 # this target is really just for my use. It only works on a limited
261 # range of machines and is used to produce a list of potentially
262 # dead (ie. unused) functions in the code. (tridge)
264 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
265 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
266 comm -13 nmused.txt nmfns.txt
268 # 'check' is the GNU name, 'test' is the name for everybody else :-)
273 # There seems to be no standard way to specify some variables as
274 # exported from a Makefile apart from listing them like this.
276 # This depends on building rsync; if we need any helper programs it
277 # should depend on them too.
279 # We try to run the scripts with POSIX mode on, in the hope that will
280 # catch Bash-isms earlier even if we're running on GNU. Of course, we
281 # might lose in the future where POSIX diverges from old sh.
283 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
284 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
286 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
287 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
289 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
290 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
292 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
293 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
294 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
296 testsuite/chown-fake.test:
297 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
299 testsuite/devices-fake.test:
300 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
302 testsuite/xattrs-hlink.test:
303 ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
305 # This does *not* depend on building or installing: you can use it to
306 # check a version installed from a binary or some other source tree,
309 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
310 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
312 # TODO: Add 'dist' target; need to know which files will be included
314 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
317 splint +unixlib +gnuextensions -weak rsync.c
320 cd $(srcdir) && rm dox/html/* && doxygen
322 # for maintainers only
324 rsync -avzv $(srcdir)/dox/html/ --delete \
325 $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/