SSE2/SSSE3 optimized version of get_checksum1() for x86-64
[rsync.git] / Makefile.in
1 # Makefile for rsync. This is processed by configure to produce the final
2 # Makefile
3
4 prefix=@prefix@
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
7 stunnel4=@STUNNEL4@
8 bindir=@bindir@
9 mandir=@mandir@
10
11 LIBS=@LIBS@
12 CC=@CC@
13 CFLAGS=@CFLAGS@
14 CPPFLAGS=@CPPFLAGS@
15 CXX=@CXX@
16 CXXFLAGS=@CXXFLAGS@
17 EXEEXT=@EXEEXT@
18 LDFLAGS=@LDFLAGS@
19 LIBOBJDIR=lib/
20
21 INSTALLCMD=@INSTALL@
22 INSTALLMAN=@INSTALL@
23
24 srcdir=@srcdir@
25 MKDIR_P=@MKDIR_P@
26 VPATH=$(srcdir)
27 SHELL=/bin/sh
28
29 VERSION=@RSYNC_VERSION@
30
31 .SUFFIXES:
32 .SUFFIXES: .c .o
33
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 \
36         lib/pool_alloc.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
46 CXXOBJ=@CXXOBJ@
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@
51
52 TLS_OBJ = tls.o syscall.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
53
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)
57
58 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
59
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
62
63 # note that the -I. is needed to handle config.h when using VPATH
64 .c.o:
65 @OBJ_SAVE@
66         $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
67 @OBJ_RESTORE@
68
69 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_MAN@
70
71 install: all
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
81
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"; \
87         fi
88
89 install-all: install install-ssl-client install-ssl-daemon
90
91 install-strip:
92         $(MAKE) INSTALL_STRIP='-s' install
93
94 rsync$(EXEEXT): $(OBJS)
95         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
96
97 $(OBJS): $(HEADERS)
98 $(CHECK_OBJS): $(HEADERS)
99 options.o: latest-year.h
100
101 flist.o: rounding.h
102
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; \
109                 fi; \
110                 break; \
111             fi; \
112         done
113         @rm -f rounding
114         @if test -f rounding.h; then : ; else \
115             cat rounding.out 1>&2; \
116             echo "Failed to create rounding.h!" 1>&2; \
117             exit 1; \
118         fi
119         @rm -f rounding.out
120
121 checksum_sse2.o: checksum_sse2.cpp
122         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
123
124 tls$(EXEEXT): $(TLS_OBJ)
125         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
126
127 testrun$(EXEEXT): testrun.o
128         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
129
130 getgroups$(EXEEXT): getgroups.o
131         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
132
133 getfsdev$(EXEEXT): getfsdev.o
134         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
135
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)
139
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)
143
144 gen: conf proto.h man
145
146 gensend: gen
147         rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
148
149 conf:
150         cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
151
152 aclocal.m4: $(srcdir)/m4/*.m4
153         aclocal -I $(srcdir)/m4
154
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; \
163         else \
164             echo "configure.sh has CHANGED."; \
165         fi
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; \
169         else \
170             echo "config.h.in has CHANGED."; \
171         fi
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".'; \
175             else \
176                 echo 'You may need to run:'; \
177                 echo '  make reconfigure'; \
178                 exit 1; \
179             fi \
180         fi
181
182 reconfigure: configure.sh
183         ./config.status --recheck
184         ./config.status
185
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
188         @./config.status
189         @if diff Makefile Makefile.old >/dev/null 2>&1; then \
190             echo "Makefile is unchanged."; \
191             rm Makefile.old; \
192         else \
193             if test "$(MAKECMDGOALS)" = reconfigure; then \
194                 echo 'Continuing with "make reconfigure".'; \
195             else \
196                 echo "Makefile updated -- rerun your make command."; \
197                 exit 1; \
198             fi \
199         fi
200
201 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
202         sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
203
204 proto: proto.h-tstamp
205
206 proto.h: proto.h-tstamp
207         @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
208
209 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
210         awk -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c
211
212 man: rsync.1 rsync-ssl.1 rsyncd.conf.5 man-copy
213
214 man-copy:
215         @for fn in rsync.1 rsync-ssl.1 rsyncd.conf.5; do \
216             if test -f $$fn; then \
217                 : ; \
218             elif test -f $(srcdir)/$$fn; then \
219                 echo "Copying srcdir $$fn" ; \
220                 cp -p $(srcdir)/$$fn . ; \
221             else \
222                 echo "NOTE: $$fn cannot be created." ; \
223             fi ; \
224         done
225
226 rsync.1: rsync.yo
227         yodl2man -o rsync.1 $(srcdir)/rsync.yo
228         -$(srcdir)/tweak_manpage rsync.1
229
230 rsync-ssl.1: rsync-ssl.yo
231         yodl2man -o rsync-ssl.1 $(srcdir)/rsync-ssl.yo
232         -$(srcdir)/tweak_manpage rsync-ssl.1
233
234 rsyncd.conf.5: rsyncd.conf.yo
235         yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
236         -$(srcdir)/tweak_manpage rsyncd.conf.5
237
238 clean: cleantests
239         rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
240                 rounding rounding.h *.old
241
242 cleantests:
243         rm -rf ./testtmp*
244
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.
248 distclean: clean
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
257         rm -f $(GENFILES)
258         rm -rf autom4te.cache
259
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)
263 finddead:
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
267
268 # 'check' is the GNU name, 'test' is the name for everybody else :-)
269 .PHONY: check test
270
271 test: check
272
273 # There seems to be no standard way to specify some variables as
274 # exported from a Makefile apart from listing them like this.
275
276 # This depends on building rsync; if we need any helper programs it
277 # should depend on them too.
278
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.
282
283 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
284         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
285
286 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
287         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
288
289 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
290         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
291
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)
295
296 testsuite/chown-fake.test:
297         ln -s chown.test $(srcdir)/testsuite/chown-fake.test
298
299 testsuite/devices-fake.test:
300         ln -s devices.test $(srcdir)/testsuite/devices-fake.test
301
302 testsuite/xattrs-hlink.test:
303         ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
304
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,
307 # if you want.
308
309 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
310         POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
311
312 # TODO: Add 'dist' target; need to know which files will be included
313
314 # Run the SPLINT (Secure Programming Lint) tool.  <www.splint.org>
315 .PHONY: splint
316 splint:
317         splint +unixlib +gnuextensions -weak rsync.c
318
319 doxygen:
320         cd $(srcdir) && rm dox/html/* && doxygen
321
322 # for maintainers only
323 doxygen-upload:
324         rsync -avzv $(srcdir)/dox/html/ --delete \
325         $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/