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)
98 options.o: latest-year.h
102 rounding.h: rounding.c rsync.h proto.h
103 @for r in 0 1 3; do \
104 if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
105 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
106 if test -f "$$HOME/build_farm/build_test.fns"; then \
107 echo "EXTRA_ROUNDING is $$r" >&2; \
113 @if test -f rounding.h; then : ; else \
114 cat rounding.out 1>&2; \
115 echo "Failed to create rounding.h!" 1>&2; \
120 tls$(EXEEXT): $(TLS_OBJ)
121 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
123 testrun$(EXEEXT): testrun.o
124 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
126 getgroups$(EXEEXT): getgroups.o
127 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
129 getfsdev$(EXEEXT): getfsdev.o
130 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
132 TRIMSLASH_OBJ = trimslash.o syscall.o lib/compat.o lib/snprintf.o
133 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
134 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
136 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
137 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
138 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
140 gen: conf proto.h man
143 rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
146 cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
148 aclocal.m4: $(srcdir)/m4/*.m4
149 aclocal -I $(srcdir)/m4
151 configure.sh config.h.in: configure.ac aclocal.m4
152 @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
153 @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
154 autoconf -o configure.sh
155 autoheader && touch config.h.in
156 @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
157 echo "configure.sh is unchanged."; \
158 rm configure.sh.old; \
160 echo "configure.sh has CHANGED."; \
162 @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
163 echo "config.h.in is unchanged."; \
164 rm config.h.in.old; \
166 echo "config.h.in has CHANGED."; \
168 @if test -f configure.sh.old -o -f config.h.in.old; then \
169 if test "$(MAKECMDGOALS)" = reconfigure; then \
170 echo 'Continuing with "make reconfigure".'; \
172 echo 'You may need to run:'; \
173 echo ' make reconfigure'; \
178 reconfigure: configure.sh
179 ./config.status --recheck
182 Makefile: Makefile.in config.status configure.sh config.h.in
183 @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
185 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
186 echo "Makefile is unchanged."; \
189 if test "$(MAKECMDGOALS)" = reconfigure; then \
190 echo 'Continuing with "make reconfigure".'; \
192 echo "Makefile updated -- rerun your make command."; \
197 rsync-ssl: $(srcdir)/rsync-ssl.in Makefile
198 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/rsync-ssl.in >rsync-ssl
201 stunnel-rsync: $(srcdir)/stunnel-rsync.in Makefile
202 sed 's;\@stunnel4\@;$(stunnel4);g' <$(srcdir)/stunnel-rsync.in >stunnel-rsync
203 @chmod +x stunnel-rsync
205 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
206 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
208 proto: proto.h-tstamp
210 proto.h: proto.h-tstamp
211 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
213 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
214 awk -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c
216 man: rsync.1 rsyncd.conf.5 man-copy
219 @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
220 @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
223 yodl2man -o rsync.1 $(srcdir)/rsync.yo
224 -$(srcdir)/tweak_manpage rsync.1
226 rsyncd.conf.5: rsyncd.conf.yo
227 yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
228 -$(srcdir)/tweak_manpage rsyncd.conf.5
231 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
232 rounding rounding.h *.old
237 # We try to delete built files from both the source and build
238 # directories, just in case somebody previously configured things in
239 # the source directory.
241 rm -f Makefile config.h config.status
242 rm -f rsync-ssl stunnel-rsync stunnel-rsyncd.conf
243 rm -f lib/dummy popt/dummy zlib/dummy
244 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
245 rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
246 rm -f config.cache config.log
247 rm -f $(srcdir)/config.cache $(srcdir)/config.log
248 rm -f shconfig $(srcdir)/shconfig
250 rm -rf autom4te.cache
252 # this target is really just for my use. It only works on a limited
253 # range of machines and is used to produce a list of potentially
254 # dead (ie. unused) functions in the code. (tridge)
256 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
257 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
258 comm -13 nmused.txt nmfns.txt
260 # 'check' is the GNU name, 'test' is the name for everybody else :-)
265 # There seems to be no standard way to specify some variables as
266 # exported from a Makefile apart from listing them like this.
268 # This depends on building rsync; if we need any helper programs it
269 # should depend on them too.
271 # We try to run the scripts with POSIX mode on, in the hope that will
272 # catch Bash-isms earlier even if we're running on GNU. Of course, we
273 # might lose in the future where POSIX diverges from old sh.
275 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
276 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
278 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
279 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
281 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
282 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
284 wildtest.o: wildtest.c lib/wildmatch.c rsync.h config.h
285 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
286 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
288 testsuite/chown-fake.test:
289 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
291 testsuite/devices-fake.test:
292 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
294 testsuite/xattrs-hlink.test:
295 ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
297 # This does *not* depend on building or installing: you can use it to
298 # check a version installed from a binary or some other source tree,
301 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
302 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
304 # TODO: Add 'dist' target; need to know which files will be included
306 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
309 splint +unixlib +gnuextensions -weak rsync.c
312 cd $(srcdir) && rm dox/html/* && doxygen
314 # for maintainers only
316 rsync -avzv $(srcdir)/dox/html/ --delete \
317 $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/