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