Improve gensend rule & list of PHONY targets.
[rsync.git] / Makefile.in
blobdc0cb0b8db15d3b8a647a31b5a7e460514822e52
1 # Makefile for rsync. This is processed by configure to produce the final
2 # Makefile
4 prefix=@prefix@
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
7 bindir=@bindir@
8 libdir=@libdir@/rsync
9 mandir=@mandir@
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/
21 INSTALLCMD=@INSTALL@
22 INSTALLMAN=@INSTALL@
24 srcdir=@srcdir@
25 MKDIR_P=@MKDIR_P@
26 VPATH=$(srcdir)
27 SHELL=/bin/sh
29 VERSION=@RSYNC_VERSION@
31 .SUFFIXES:
32 .SUFFIXES: .c .o
34 SIMD_x86_64=simd-checksum-x86_64.o lib/md5-asm-x86_64.o
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@
54 TLS_OBJ = tls.o syscall.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
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)
60 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
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
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@
71 .PHONY: all
72 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf man
74 .PHONY: install
75 install: all
76 -${MKDIR_P} ${DESTDIR}${bindir}
77 -${MKDIR_P} ${DESTDIR}${libdir}
78 ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
79 ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir}
80 ${INSTALLCMD} -m 755 ssl-rsh ${DESTDIR}${libdir}
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
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"; \
94 install-all: install install-ssl-client install-ssl-daemon
96 install-strip:
97 $(MAKE) INSTALL_STRIP='-s' install
99 rsync$(EXEEXT): $(OBJS)
100 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
102 $(OBJS): $(HEADERS)
103 $(CHECK_OBJS): $(HEADERS)
104 options.o: latest-year.h
106 flist.o: rounding.h
108 rounding.h: rounding.c rsync.h proto.h
109 @for r in 0 1 3; do \
110 if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
111 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
112 if test -f "$$HOME/build_farm/build_test.fns"; then \
113 echo "EXTRA_ROUNDING is $$r" >&2; \
114 fi; \
115 break; \
116 fi; \
117 done
118 @rm -f rounding
119 @if test -f rounding.h; then : ; else \
120 cat rounding.out 1>&2; \
121 echo "Failed to create rounding.h!" 1>&2; \
122 exit 1; \
124 @rm -f rounding.out
126 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
127 $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
129 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.s
130 $(CC) -c -o $@ $<
132 tls$(EXEEXT): $(TLS_OBJ)
133 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
135 testrun$(EXEEXT): testrun.o
136 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
138 getgroups$(EXEEXT): getgroups.o
139 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
141 getfsdev$(EXEEXT): getfsdev.o
142 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
144 TRIMSLASH_OBJ = trimslash.o syscall.o t_stub.o lib/compat.o lib/snprintf.o
145 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
146 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
148 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
149 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
150 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
152 .PHONY: conf
153 conf: configure.sh config.h.in
155 .PHONY: gen
156 gen: conf proto.h man
158 .PHONY: gensend
159 gensend: gen
160 rsync -aic $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
162 aclocal.m4: $(srcdir)/m4/*.m4
163 aclocal -I $(srcdir)/m4
165 configure.sh config.h.in: configure.ac aclocal.m4
166 @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
167 @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
168 autoconf -o configure.sh
169 autoheader && touch config.h.in
170 @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
171 echo "configure.sh is unchanged."; \
172 rm configure.sh.old; \
173 else \
174 echo "configure.sh has CHANGED."; \
176 @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
177 echo "config.h.in is unchanged."; \
178 rm config.h.in.old; \
179 else \
180 echo "config.h.in has CHANGED."; \
182 @if test -f configure.sh.old -o -f config.h.in.old; then \
183 if test "$(MAKECMDGOALS)" = reconfigure; then \
184 echo 'Continuing with "make reconfigure".'; \
185 else \
186 echo 'You may need to run:'; \
187 echo ' make reconfigure'; \
188 exit 1; \
189 fi \
192 .PHONY: reconfigure
193 reconfigure: configure.sh
194 ./config.status --recheck
195 ./config.status
197 Makefile: Makefile.in config.status configure.sh config.h.in
198 @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
199 @./config.status
200 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
201 echo "Makefile is unchanged."; \
202 rm Makefile.old; \
203 else \
204 if test "$(MAKECMDGOALS)" = reconfigure; then \
205 echo 'Continuing with "make reconfigure".'; \
206 else \
207 echo "Makefile updated -- rerun your make command."; \
208 exit 1; \
209 fi \
212 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
213 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
215 .PHONY: proto
216 proto: proto.h-tstamp
218 proto.h: proto.h-tstamp
219 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
221 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
222 awk -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c
224 .PHONY: man
225 man: rsync.1 rsync-ssl.1 rsyncd.conf.5
227 rsync.1: rsync.1.md md2man NEWS.md Makefile
228 @$(srcdir)/maybe-make-man $(srcdir) rsync.1.md
230 rsync-ssl.1: rsync-ssl.1.md md2man NEWS.md Makefile
231 @$(srcdir)/maybe-make-man $(srcdir) rsync-ssl.1.md
233 rsyncd.conf.5: rsyncd.conf.5.md md2man NEWS.md Makefile
234 @$(srcdir)/maybe-make-man $(srcdir) rsyncd.conf.5.md
236 .PHONY: clean
237 clean: cleantests
238 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
239 rounding rounding.h *.old
241 .PHONY: cleantests
242 cleantests:
243 rm -rf ./testtmp*
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 .PHONY: distclean
249 distclean: clean
250 rm -f Makefile config.h config.status
251 rm -f stunnel-rsyncd.conf
252 rm -f lib/dummy popt/dummy zlib/dummy
253 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
254 rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
255 rm -f config.cache config.log
256 rm -f $(srcdir)/config.cache $(srcdir)/config.log
257 rm -f shconfig $(srcdir)/shconfig
258 rm -f $(GENFILES)
259 rm -rf autom4te.cache
261 # this target is really just for my use. It only works on a limited
262 # range of machines and is used to produce a list of potentially
263 # dead (ie. unused) functions in the code. (tridge)
264 .PHONY: finddead
265 finddead:
266 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
267 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
268 comm -13 nmused.txt nmfns.txt
270 # 'check' is the GNU name, 'test' is the name for everybody else :-)
271 .PHONY: test
272 test: check
274 # There seems to be no standard way to specify some variables as
275 # exported from a Makefile apart from listing them like this.
277 # This depends on building rsync; if we need any helper programs it
278 # should depend on them too.
280 # We try to run the scripts with POSIX mode on, in the hope that will
281 # catch Bash-isms earlier even if we're running on GNU. Of course, we
282 # might lose in the future where POSIX diverges from old sh.
284 .PHONY: check
285 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
286 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
288 .PHONY: check29
289 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
290 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
292 .PHONY: check30
293 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
294 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
296 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
297 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
298 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
300 testsuite/chown-fake.test:
301 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
303 testsuite/devices-fake.test:
304 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
306 testsuite/xattrs-hlink.test:
307 ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
309 # This does *not* depend on building or installing: you can use it to
310 # check a version installed from a binary or some other source tree,
311 # if you want.
313 .PHONY: installcheck
314 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
315 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
317 # TODO: Add 'dist' target; need to know which files will be included
319 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
320 .PHONY: splint
321 splint:
322 splint +unixlib +gnuextensions -weak rsync.c
324 .PHONY: doxygen
325 doxygen:
326 cd $(srcdir) && rm dox/html/* && doxygen
328 # for maintainers only
329 .PHONY: doxygen-upload
330 doxygen-upload:
331 rsync -avzv $(srcdir)/dox/html/ --delete \
332 $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/