1 # Makefile for rsync. This is processed by configure to produce the final
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
30 VERSION=@RSYNC_VERSION@
35 SIMD_x86_64=simd-checksum-x86_64.o lib/md5-asm-x86_64.o
37 GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsync.1.html \
38 rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html
39 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
41 LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
42 lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@
43 zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
44 zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
45 OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
46 util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
47 OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
48 fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
49 OBJS3=progress.o pipe.o
50 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
51 popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
52 popt/popthelp.o popt/poptparse.o
53 OBJS=$(OBJS1) $(OBJS2) $(OBJS3) @SIMD@ $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
55 TLS_OBJ = tls.o syscall.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
57 # Programs we must have to run the test cases
58 CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
59 testrun$(EXEEXT) trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
61 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
63 # Objects for CHECK_PROGS to clean
64 CHECK_OBJS=tls.o testrun.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
66 # note that the -I. is needed to handle config.h when using VPATH
69 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
73 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_MAN@
77 -${MKDIR_P} ${DESTDIR}${bindir}
78 ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
79 ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir}
80 -${MKDIR_P} ${DESTDIR}${mandir}/man1
81 -${MKDIR_P} ${DESTDIR}${mandir}/man5
82 if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi
83 if test -f rsync-ssl.1; then ${INSTALLMAN} -m 644 rsync-ssl.1 ${DESTDIR}${mandir}/man1; fi
84 if test -f rsyncd.conf.5; then ${INSTALLMAN} -m 644 rsyncd.conf.5 ${DESTDIR}${mandir}/man5; fi
86 install-ssl-daemon: stunnel-rsyncd.conf
87 -${MKDIR_P} ${DESTDIR}/etc/stunnel
88 ${INSTALLCMD} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf
89 @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
90 echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
93 install-all: install install-ssl-client install-ssl-daemon
96 $(MAKE) INSTALL_STRIP='-s' install
98 rsync$(EXEEXT): $(OBJS)
99 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
102 $(CHECK_OBJS): $(HEADERS)
103 tls.o xattrs.o: lib/sysxattrs.h
104 options.o: latest-year.h help-rsync.h help-rsyncd.h
105 exclude.o: default-cvsignore.h
106 loadparm.o: default-dont-compress.h
110 default-cvsignore.h default-dont-compress.h: rsync.1.md define-from-md.awk
111 $(AWK) -f $(srcdir)/define-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
113 help-rsync.h help-rsyncd.h: rsync.1.md help-from-md.awk
114 $(AWK) -f $(srcdir)/help-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
116 rounding.h: rounding.c rsync.h proto.h
117 @for r in 0 1 3; do \
118 if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
119 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
120 if test -f "$$HOME/build_farm/build_test.fns"; then \
121 echo "EXTRA_ROUNDING is $$r" >&2; \
127 @if test -f rounding.h; then : ; else \
128 cat rounding.out 1>&2; \
129 echo "Failed to create rounding.h!" 1>&2; \
134 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
135 $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
137 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.s
138 $(CC) -I. -c -o $@ $(srcdir)/lib/md5-asm-x86_64.s
140 tls$(EXEEXT): $(TLS_OBJ)
141 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
143 testrun$(EXEEXT): testrun.o
144 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
146 getgroups$(EXEEXT): getgroups.o
147 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
149 getfsdev$(EXEEXT): getfsdev.o
150 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
152 TRIMSLASH_OBJ = trimslash.o syscall.o t_stub.o lib/compat.o lib/snprintf.o
153 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
154 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
156 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
157 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
158 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
161 conf: configure.sh config.h.in
164 gen: conf proto.h man
168 rsync -aic $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
170 aclocal.m4: $(srcdir)/m4/*.m4
171 aclocal -I $(srcdir)/m4
173 configure.sh config.h.in: configure.ac aclocal.m4
174 @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
175 @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
176 autoconf -o configure.sh
177 autoheader && touch config.h.in
178 @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
179 echo "configure.sh is unchanged."; \
180 rm configure.sh.old; \
182 echo "configure.sh has CHANGED."; \
184 @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
185 echo "config.h.in is unchanged."; \
186 rm config.h.in.old; \
188 echo "config.h.in has CHANGED."; \
190 @if test -f configure.sh.old -o -f config.h.in.old; then \
191 if test "$(MAKECMDGOALS)" = reconfigure; then \
192 echo 'Continuing with "make reconfigure".'; \
194 echo 'You may need to run:'; \
195 echo ' make reconfigure'; \
201 reconfigure: configure.sh
202 ./config.status --recheck
205 Makefile: Makefile.in config.status configure.sh config.h.in
206 @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
208 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
209 echo "Makefile is unchanged."; \
212 if test "$(MAKECMDGOALS)" = reconfigure; then \
213 echo 'Continuing with "make reconfigure".'; \
215 echo "Makefile updated -- rerun your make command."; \
220 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
221 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
224 proto: proto.h-tstamp
226 proto.h: proto.h-tstamp
227 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
229 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
230 $(AWK) -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c
233 man: rsync.1 rsync-ssl.1 rsyncd.conf.5
235 rsync.1: rsync.1.md md2man NEWS.md Makefile
236 @$(srcdir)/maybe-make-man $(srcdir) rsync.1.md
238 rsync-ssl.1: rsync-ssl.1.md md2man NEWS.md Makefile
239 @$(srcdir)/maybe-make-man $(srcdir) rsync-ssl.1.md
241 rsyncd.conf.5: rsyncd.conf.5.md md2man NEWS.md Makefile
242 @$(srcdir)/maybe-make-man $(srcdir) rsyncd.conf.5.md
246 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
247 rounding rounding.h *.old rsync*.1 rsync*.5 rsync*.html
253 # We try to delete built files from both the source and build
254 # directories, just in case somebody previously configured things in
255 # the source directory.
258 rm -f Makefile config.h config.status
259 rm -f stunnel-rsyncd.conf
260 rm -f lib/dummy popt/dummy zlib/dummy
261 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
262 rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
263 rm -f config.cache config.log
264 rm -f $(srcdir)/config.cache $(srcdir)/config.log
265 rm -f shconfig $(srcdir)/shconfig
267 rm -rf autom4te.cache
269 # this target is really just for my use. It only works on a limited
270 # range of machines and is used to produce a list of potentially
271 # dead (ie. unused) functions in the code. (tridge)
274 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
275 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
276 comm -13 nmused.txt nmfns.txt
278 # 'check' is the GNU name, 'test' is the name for everybody else :-)
282 # There seems to be no standard way to specify some variables as
283 # exported from a Makefile apart from listing them like this.
285 # This depends on building rsync; if we need any helper programs it
286 # should depend on them too.
288 # We try to run the scripts with POSIX mode on, in the hope that will
289 # catch Bash-isms earlier even if we're running on GNU. Of course, we
290 # might lose in the future where POSIX diverges from old sh.
293 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
294 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
297 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
298 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
301 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
302 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
304 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
305 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
306 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
308 testsuite/chown-fake.test:
309 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
311 testsuite/devices-fake.test:
312 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
314 testsuite/xattrs-hlink.test:
315 ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
317 # This does *not* depend on building or installing: you can use it to
318 # check a version installed from a binary or some other source tree,
322 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
323 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
325 # TODO: Add 'dist' target; need to know which files will be included
327 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
330 splint +unixlib +gnuextensions -weak rsync.c
334 cd $(srcdir) && rm dox/html/* && doxygen
336 # for maintainers only
337 .PHONY: doxygen-upload
339 rsync -avzv $(srcdir)/dox/html/ --delete \
340 $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/