33f7853862beb9a5da3586c30ba6743b032aa367
[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 bindir=@bindir@
8 libdir=@libdir@/rsync
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 SIMD_x86_64=simd-checksum-x86_64.o lib/md5-asm-x86_64.o
35
36 GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsync.1.html \
37          rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html
38 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
39         lib/pool_alloc.h
40 LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
41         lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@
42 zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
43         zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
44 OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
45         util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
46 OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
47         fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
48 OBJS3=progress.o pipe.o
49 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
50 popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
51         popt/popthelp.o popt/poptparse.o
52 OBJS=$(OBJS1) $(OBJS2) $(OBJS3) @SIMD@ $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
53
54 TLS_OBJ = tls.o syscall.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
55
56 # Programs we must have to run the test cases
57 CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
58         testrun$(EXEEXT) trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
59
60 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
61
62 # Objects for CHECK_PROGS to clean
63 CHECK_OBJS=tls.o testrun.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
64
65 # note that the -I. is needed to handle config.h when using VPATH
66 .c.o:
67 @OBJ_SAVE@
68         $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
69 @OBJ_RESTORE@
70
71 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf man
72
73 install: all
74         -${MKDIR_P} ${DESTDIR}${bindir}
75         -${MKDIR_P} ${DESTDIR}${libdir}
76         ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
77         ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir}
78         ${INSTALLCMD} -m 755 ssl-rsh ${DESTDIR}${libdir}
79         -${MKDIR_P} ${DESTDIR}${mandir}/man1
80         -${MKDIR_P} ${DESTDIR}${mandir}/man5
81         if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi
82         if test -f rsync-ssl.1; then ${INSTALLMAN} -m 644 rsync-ssl.1 ${DESTDIR}${mandir}/man1; fi
83         if test -f rsyncd.conf.5; then ${INSTALLMAN} -m 644 rsyncd.conf.5 ${DESTDIR}${mandir}/man5; fi
84
85 install-ssl-daemon: stunnel-rsyncd.conf
86         -${MKDIR_P} ${DESTDIR}/etc/stunnel
87         ${INSTALLCMD} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf
88         @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
89             echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
90         fi
91
92 install-all: install install-ssl-client install-ssl-daemon
93
94 install-strip:
95         $(MAKE) INSTALL_STRIP='-s' install
96
97 rsync$(EXEEXT): $(OBJS)
98         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
99
100 $(OBJS): $(HEADERS)
101 $(CHECK_OBJS): $(HEADERS)
102 options.o: latest-year.h
103
104 flist.o: rounding.h
105
106 rounding.h: rounding.c rsync.h proto.h
107         @for r in 0 1 3; do \
108             if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
109                 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
110                 if test -f "$$HOME/build_farm/build_test.fns"; then \
111                     echo "EXTRA_ROUNDING is $$r" >&2; \
112                 fi; \
113                 break; \
114             fi; \
115         done
116         @rm -f rounding
117         @if test -f rounding.h; then : ; else \
118             cat rounding.out 1>&2; \
119             echo "Failed to create rounding.h!" 1>&2; \
120             exit 1; \
121         fi
122         @rm -f rounding.out
123
124 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
125         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
126
127 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.s
128         $(CC) -c -o $@ $<
129
130 tls$(EXEEXT): $(TLS_OBJ)
131         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
132
133 testrun$(EXEEXT): testrun.o
134         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
135
136 getgroups$(EXEEXT): getgroups.o
137         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
138
139 getfsdev$(EXEEXT): getfsdev.o
140         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
141
142 TRIMSLASH_OBJ = trimslash.o syscall.o t_stub.o lib/compat.o lib/snprintf.o
143 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
144         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
145
146 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
147 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
148         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
149
150 gen: conf proto.h man
151
152 gensend: gen
153         rsync -aic $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
154
155 conf:
156         cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
157
158 aclocal.m4: $(srcdir)/m4/*.m4
159         aclocal -I $(srcdir)/m4
160
161 configure.sh config.h.in: configure.ac aclocal.m4
162         @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
163         @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
164         autoconf -o configure.sh
165         autoheader && touch config.h.in
166         @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
167             echo "configure.sh is unchanged."; \
168             rm configure.sh.old; \
169         else \
170             echo "configure.sh has CHANGED."; \
171         fi
172         @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
173             echo "config.h.in is unchanged."; \
174             rm config.h.in.old; \
175         else \
176             echo "config.h.in has CHANGED."; \
177         fi
178         @if test -f configure.sh.old -o -f config.h.in.old; then \
179             if test "$(MAKECMDGOALS)" = reconfigure; then \
180                 echo 'Continuing with "make reconfigure".'; \
181             else \
182                 echo 'You may need to run:'; \
183                 echo '  make reconfigure'; \
184                 exit 1; \
185             fi \
186         fi
187
188 reconfigure: configure.sh
189         ./config.status --recheck
190         ./config.status
191
192 Makefile: Makefile.in config.status configure.sh config.h.in
193         @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
194         @./config.status
195         @if diff Makefile Makefile.old >/dev/null 2>&1; then \
196             echo "Makefile is unchanged."; \
197             rm Makefile.old; \
198         else \
199             if test "$(MAKECMDGOALS)" = reconfigure; then \
200                 echo 'Continuing with "make reconfigure".'; \
201             else \
202                 echo "Makefile updated -- rerun your make command."; \
203                 exit 1; \
204             fi \
205         fi
206
207 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
208         sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
209
210 proto: proto.h-tstamp
211
212 proto.h: proto.h-tstamp
213         @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
214
215 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
216         awk -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c
217
218 man: rsync.1 rsync-ssl.1 rsyncd.conf.5
219
220 rsync.1: rsync.1.md md2man NEWS.md Makefile
221         @$(srcdir)/maybe-make-man $(srcdir) rsync.1.md
222
223 rsync-ssl.1: rsync-ssl.1.md md2man NEWS.md Makefile
224         @$(srcdir)/maybe-make-man $(srcdir) rsync-ssl.1.md
225
226 rsyncd.conf.5: rsyncd.conf.5.md md2man NEWS.md Makefile
227         @$(srcdir)/maybe-make-man $(srcdir) rsyncd.conf.5.md
228
229 clean: cleantests
230         rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
231                 rounding rounding.h *.old
232
233 cleantests:
234         rm -rf ./testtmp*
235
236 # We try to delete built files from both the source and build
237 # directories, just in case somebody previously configured things in
238 # the source directory.
239 distclean: clean
240         rm -f Makefile config.h config.status
241         rm -f stunnel-rsyncd.conf
242         rm -f lib/dummy popt/dummy zlib/dummy
243         rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
244         rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
245         rm -f config.cache config.log
246         rm -f $(srcdir)/config.cache $(srcdir)/config.log
247         rm -f shconfig $(srcdir)/shconfig
248         rm -f $(GENFILES)
249         rm -rf autom4te.cache
250
251 # this target is really just for my use. It only works on a limited
252 # range of machines and is used to produce a list of potentially
253 # dead (ie. unused) functions in the code. (tridge)
254 finddead:
255         nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
256         nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
257         comm -13 nmused.txt nmfns.txt
258
259 # 'check' is the GNU name, 'test' is the name for everybody else :-)
260 .PHONY: check test
261
262 test: check
263
264 # There seems to be no standard way to specify some variables as
265 # exported from a Makefile apart from listing them like this.
266
267 # This depends on building rsync; if we need any helper programs it
268 # should depend on them too.
269
270 # We try to run the scripts with POSIX mode on, in the hope that will
271 # catch Bash-isms earlier even if we're running on GNU.  Of course, we
272 # might lose in the future where POSIX diverges from old sh.
273
274 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
275         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
276
277 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
278         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
279
280 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
281         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
282
283 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
284 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
285         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
286
287 testsuite/chown-fake.test:
288         ln -s chown.test $(srcdir)/testsuite/chown-fake.test
289
290 testsuite/devices-fake.test:
291         ln -s devices.test $(srcdir)/testsuite/devices-fake.test
292
293 testsuite/xattrs-hlink.test:
294         ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
295
296 # This does *not* depend on building or installing: you can use it to
297 # check a version installed from a binary or some other source tree,
298 # if you want.
299
300 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
301         POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
302
303 # TODO: Add 'dist' target; need to know which files will be included
304
305 # Run the SPLINT (Secure Programming Lint) tool.  <www.splint.org>
306 .PHONY: splint
307 splint:
308         splint +unixlib +gnuextensions -weak rsync.c
309
310 doxygen:
311         cd $(srcdir) && rm dox/html/* && doxygen
312
313 # for maintainers only
314 doxygen-upload:
315         rsync -avzv $(srcdir)/dox/html/ --delete \
316         $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/