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