Debian Codegraph @

Makefile.in

raw ◀ ▶
2 Debian patches touch this file
1 # The Makefile for rsync (configure creates it from Makefile.in).
2
3 prefix=@prefix@
4 datarootdir=@datarootdir@
5 exec_prefix=@exec_prefix@
6 bindir=@bindir@
7 libdir=@libdir@/rsync
8 mandir=@mandir@
9 with_rrsync=@with_rrsync@
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 STRIP=@STRIP@
25
26 srcdir=@srcdir@
27 MKDIR_P=@MKDIR_P@
28 VPATH=$(srcdir)
29 SHELL=/bin/sh
30
31 .SUFFIXES:
32 .SUFFIXES: .c .o
33
34 ROLL_SIMD_x86_64=simd-checksum-x86_64.o
35 ROLL_ASM_x86_64=simd-checksum-avx2.o
36 MD5_ASM_x86_64=lib/md5-asm-x86_64.o
37
38 GENFILES=configure.sh aclocal.m4 config.h.in rsync.1 rsync.1.html \
39 rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html \
40 @GEN_RRSYNC@
41 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
42 lib/pool_alloc.h lib/mdigest.h lib/md-defines.h
43 LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
44 lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o lib/acl.o @LIBOBJS@
45 zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
46 zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
47 OBJS1_NO_MAIN=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
48 util1.o util2.o checksum.o match.o syscall.o log.o backup.o delete.o
49 OBJS1=$(OBJS1_NO_MAIN) main.o
50 OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
51 usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
52 OBJS3=progress.o pipe.o @MD5_ASM@ @ROLL_SIMD@ @ROLL_ASM@
53 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
54 popt_OBJS= popt/popt.o popt/poptconfig.o \
55 popt/popthelp.o popt/poptparse.o popt/poptint.o
56 OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
57
58 TLS_OBJ = tls.o syscall.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
59
60 # Programs we must have to run the test cases
61 CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
62 testrun$(EXEEXT) trimslash$(EXEEXT) t_unsafe$(EXEEXT) t_chmod_secure$(EXEEXT) \
63 t_rename_secure$(EXEEXT) t_symlink_secure$(EXEEXT) t_secure_relpath$(EXEEXT) t_acl$(EXEEXT) t_hashtable_overflow$(EXEEXT) t_iwildmatch$(EXEEXT) t_clean_fname$(EXEEXT) t_safe_arg$(EXEEXT) wildtest$(EXEEXT) simdtest$(EXEEXT)
64
65 CHECK_SYMLINKS = testsuite/chown-fake_test.py testsuite/devices-fake_test.py \
66 testsuite/xattrs-hlink_test.py testsuite/exclude-lsh_test.py
67
68 # Objects for CHECK_PROGS to clean
69 CHECK_OBJS=tls.o testrun.o getgroups.o getfsdev.o t_stub.o t_unsafe.o t_chmod_secure.o t_rename_secure.o t_symlink_secure.o t_secure_relpath.o t_acl.o t_hashtable_overflow.o t_iwildmatch.o t_clean_fname.o t_safe_arg.o trimslash.o wildtest.o
70 # Compile-only feature-shape checks.
71 CHECK_COMPILE_OBJS=syscall-no-at-fdcwd.o
72
73 # note that the -I. is needed to handle config.h when using VPATH
74 .c.o:
75 @OBJ_SAVE@
76 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
77 @OBJ_RESTORE@
78
79 # NOTE: consider running "packaging/smart-make" instead of "make" to auto-handle
80 # any changes to configure.sh and the main Makefile prior to a "make all".
81 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_RRSYNC@ @MAKE_MAN@
82 .PHONY: all
83
84 syscall-no-at-fdcwd.o: syscall.c $(HEADERS)
85 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) \
86 -DRSYNC_TEST_NO_AT_FDCWD -c $(srcdir)/syscall.c -o $@
87
88 .PHONY: install
89 install: all
90 -$(MKDIR_P) $(DESTDIR)$(bindir)
91 $(INSTALLCMD) $(INSTALL_STRIP) -m 755 rsync$(EXEEXT) $(DESTDIR)$(bindir)
92 $(INSTALLCMD) -m 755 $(srcdir)/rsync-ssl $(DESTDIR)$(bindir)
93 -$(MKDIR_P) $(DESTDIR)$(mandir)/man1
94 -$(MKDIR_P) $(DESTDIR)$(mandir)/man5
95 for fn in rsync.1 rsync-ssl.1; do \
96 if test -f $$fn; then $(INSTALLMAN) -m 644 $$fn $(DESTDIR)$(mandir)/man1; \
97 elif test -f $(srcdir)/$$fn; then $(INSTALLMAN) -m 644 $(srcdir)/$$fn $(DESTDIR)$(mandir)/man1; fi; \
98 done
99 for fn in rsyncd.conf.5; do \
100 if test -f $$fn; then $(INSTALLMAN) -m 644 $$fn $(DESTDIR)$(mandir)/man5; \
101 elif test -f $(srcdir)/$$fn; then $(INSTALLMAN) -m 644 $(srcdir)/$$fn $(DESTDIR)$(mandir)/man5; fi; \
102 done
103 if test "$(with_rrsync)" = yes; then \
104 $(INSTALLCMD) -m 755 rrsync $(DESTDIR)$(bindir); \
105 fn=rrsync.1; \
106 if test -f $$fn; then $(INSTALLMAN) -m 644 $$fn $(DESTDIR)$(mandir)/man1; \
107 elif test -f $(srcdir)/$$fn; then $(INSTALLMAN) -m 644 $(srcdir)/$$fn $(DESTDIR)$(mandir)/man1; fi; \
108 fi
109
110 install-ssl-daemon: stunnel-rsyncd.conf
111 -$(MKDIR_P) $(DESTDIR)/etc/stunnel
112 $(INSTALLCMD) -m 644 stunnel-rsyncd.conf $(DESTDIR)/etc/stunnel/rsyncd.conf
113 @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
114 echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
115 fi
116
117 install-all: install install-ssl-daemon
118
119 install-strip:
•120 $(MAKE) install
121 $(STRIP) $(DESTDIR)$(bindir)/rsync$(EXEEXT)
122
123 .PHONY: uninstall
124 uninstall:
125 rm -f $(DESTDIR)$(bindir)/rsync$(EXEEXT) $(DESTDIR)$(bindir)/rsync-ssl
126 rm -f $(DESTDIR)$(bindir)/rrsync
127 rm -f $(DESTDIR)$(mandir)/man1/rsync.1 $(DESTDIR)$(mandir)/man1/rsync-ssl.1
128 rm -f $(DESTDIR)$(mandir)/man1/rrsync.1
129 rm -f $(DESTDIR)$(mandir)/man5/rsyncd.conf.5
130
131 .PHONY: uninstall-ssl-daemon
132 uninstall-ssl-daemon:
133 rm -f $(DESTDIR)/etc/stunnel/rsyncd.conf
134
135 .PHONY: uninstall-all
136 uninstall-all: uninstall uninstall-ssl-daemon
137
138 rsync$(EXEEXT): $(OBJS)
139 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
140
141 rrsync: support/rrsync
142 cp -p $(srcdir)/support/rrsync rrsync
143
144 $(OBJS): $(HEADERS)
145 $(CHECK_OBJS): $(HEADERS)
146 tls.o xattrs.o: lib/sysxattrs.h
147 usage.o: version.h latest-year.h help-rsync.h help-rsyncd.h git-version.h default-cvsignore.h
148 loadparm.o: default-dont-compress.h daemon-parm.h
149
150 flist.o: rounding.h
151 log.o: rounding.h
152
153 default-cvsignore.h default-dont-compress.h: rsync.1.md define-from-md.awk
154 $(AWK) -f $(srcdir)/define-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
155
156 help-rsync.h help-rsyncd.h: rsync.1.md help-from-md.awk
157 $(AWK) -f $(srcdir)/help-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
158
159 daemon-parm.h: daemon-parm.txt daemon-parm.awk
160 $(AWK) -f $(srcdir)/daemon-parm.awk $(srcdir)/daemon-parm.txt
161
162 rounding.h: rounding.c rsync.h proto.h
163 @for r in 0 1 3; do \
164 if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
165 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
166 if test -f "$$HOME/build_farm/build_test.fns"; then \
167 echo "EXTRA_ROUNDING is $$r" >&2; \
168 fi; \
169 break; \
170 fi; \
171 done
172 @rm -f rounding
173 @if test -f rounding.h; then : ; else \
174 cat rounding.out 1>&2; \
175 echo "Failed to create rounding.h!" 1>&2; \
176 exit 1; \
177 fi
178 @rm -f rounding.out
179
180 git-version.h: ALWAYS_RUN
181 $(srcdir)/mkgitver
182
183 .PHONY: ALWAYS_RUN
184 ALWAYS_RUN:
185
186 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
187 @$(srcdir)/cmd-or-msg disable-roll-simd $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
188
189 simd-checksum-avx2.o: simd-checksum-avx2.S
190 @$(srcdir)/cmd-or-msg disable-roll-asm $(CC) $(CFLAGS) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/simd-checksum-avx2.S
191
192 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.S lib/md-defines.h
193 @$(srcdir)/cmd-or-msg disable-md5-asm $(CC) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
194
195 tls$(EXEEXT): $(TLS_OBJ)
196 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
197
198 testrun$(EXEEXT): testrun.o
199 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
200
201 getgroups$(EXEEXT): getgroups.o
202 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
203
204 getfsdev$(EXEEXT): getfsdev.o
205 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
206
207 TRIMSLASH_OBJ = trimslash.o syscall.o util2.o t_stub.o lib/compat.o lib/snprintf.o
208 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
209 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
210
211 T_UNSAFE_OBJ = t_unsafe.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
212 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
213 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
214
215 T_HASHTABLE_OVERFLOW_OBJ = t_hashtable_overflow.o hashtable.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
216 t_hashtable_overflow$(EXEEXT): $(T_HASHTABLE_OVERFLOW_OBJ)
217 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_HASHTABLE_OVERFLOW_OBJ) $(LIBS)
218
219 T_IWILDMATCH_OBJ = t_iwildmatch.o lib/wildmatch.o
220 t_iwildmatch$(EXEEXT): $(T_IWILDMATCH_OBJ)
221 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_IWILDMATCH_OBJ) $(LIBS)
222
223 T_CLEAN_FNAME_OBJ = t_clean_fname.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
224 t_clean_fname$(EXEEXT): $(T_CLEAN_FNAME_OBJ)
225 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_CLEAN_FNAME_OBJ) $(LIBS)
226
227 # safe_arg lives in options.c alongside the whole option parser. Rather than
228 # rely on a non-portable linker --gc-sections to drop the parser (GNU ld only;
229 # macOS ld64 and the cygwin PE linker do not), link the real rsync objects so
230 # every dep resolves. t_safe_arg_main.o is main.c with main() renamed out, to
231 # supply main.c's globals while letting t_safe_arg.o provide the test's main().
232 # OBJS minus main.o is spelled out via OBJS1_NO_MAIN because $(filter-out) is
233 # GNU-make-only; BSD and Solaris make expand it to nothing.
234 t_safe_arg_main.o: main.c $(HEADERS)
235 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -Dmain=rsync_unused_main -c $(srcdir)/main.c -o t_safe_arg_main.o
236 T_SAFE_ARG_OBJ = t_safe_arg.o t_safe_arg_main.o $(OBJS1_NO_MAIN) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
237 t_safe_arg$(EXEEXT): $(T_SAFE_ARG_OBJ)
238 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_SAFE_ARG_OBJ) $(LIBS)
239
240 T_CHMOD_SECURE_OBJ = t_chmod_secure.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
241 t_chmod_secure$(EXEEXT): $(T_CHMOD_SECURE_OBJ)
242 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_CHMOD_SECURE_OBJ) $(LIBS)
243
244 T_RENAME_SECURE_OBJ = t_rename_secure.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
245 t_rename_secure$(EXEEXT): $(T_RENAME_SECURE_OBJ)
246 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_RENAME_SECURE_OBJ) $(LIBS)
247
248 T_SYMLINK_SECURE_OBJ = t_symlink_secure.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
249 t_symlink_secure$(EXEEXT): $(T_SYMLINK_SECURE_OBJ)
250 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_SYMLINK_SECURE_OBJ) $(LIBS)
251
252 T_SECURE_RELPATH_OBJ = t_secure_relpath.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o lib/permstring.o
253 t_secure_relpath$(EXEEXT): $(T_SECURE_RELPATH_OBJ)
254 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_SECURE_RELPATH_OBJ) $(LIBS)
255
256 # Unit test for lib/acl.c: compares our fd/at ACL ops against the system libacl
257 # (linked via $(LIBS), which carries -lacl). lib/acl.o references no rsync
258 # globals, so this links with no stubs. Self-skips (exit 77) when built
259 # without SUPPORT_ACL_FD.
260 T_ACL_OBJ = t_acl.o lib/acl.o
261 t_acl$(EXEEXT): $(T_ACL_OBJ)
262 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_ACL_OBJ) $(LIBS)
263
264 .PHONY: conf
265 conf: configure.sh config.h.in
266
267 .PHONY: gen
268 gen: conf proto.h man git-version.h
269
270 aclocal.m4: $(srcdir)/m4/*.m4
271 aclocal -I $(srcdir)/m4
272
273 configure.sh config.h.in: configure.ac aclocal.m4
274 @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
275 @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
276 autoconf -o configure.sh
277 autoheader && touch config.h.in
278 @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
279 echo "configure.sh is unchanged."; \
280 rm configure.sh.old; \
281 else \
282 echo "configure.sh has CHANGED."; \
283 fi
284 @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
285 echo "config.h.in is unchanged."; \
286 rm config.h.in.old; \
287 else \
288 echo "config.h.in has CHANGED."; \
289 fi
290
291 .PHONY: reconfigure
292 reconfigure: configure.sh
293 ./config.status --recheck
294 ./config.status
295
296 .PHONY: restatus
297 restatus:
298 ./config.status
299
300 Makefile: Makefile.in config.status configure.sh config.h.in
301 @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
302 @./config.status
303
304 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
305 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
306
307 .PHONY: proto
308 proto: proto.h-tstamp
309
310 proto.h: proto.h-tstamp
311 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
312
313 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c daemon-parm.h
314 $(AWK) -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c daemon-parm.h
315
316 .PHONY: man
317 man: rsync.1 rsync-ssl.1 rsyncd.conf.5 @MAKE_RRSYNC_1@
318
319 rsync.1: rsync.1.md md-convert version.h Makefile
320 @$(srcdir)/maybe-make-man rsync.1.md
321
322 rsync-ssl.1: rsync-ssl.1.md md-convert version.h Makefile
323 @$(srcdir)/maybe-make-man rsync-ssl.1.md
324
325 rsyncd.conf.5: rsyncd.conf.5.md md-convert version.h Makefile
326 @$(srcdir)/maybe-make-man rsyncd.conf.5.md
327
328 rrsync.1: support/rrsync.1.md md-convert Makefile
329 @$(srcdir)/maybe-make-man support/rrsync.1.md
330
331 .PHONY: clean
332 clean: cleantests
333 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS) @MAKE_RRSYNC@ \
334 git-version.h rounding rounding.h *.old rsync*.1 rsync*.5 @MAKE_RRSYNC_1@ \
335 *.html daemon-parm.h help-*.h default-*.h proto.h proto.h-tstamp
336 rm -f *.gcno *.gcda lib/*.gcno lib/*.gcda zlib/*.gcno zlib/*.gcda popt/*.gcno popt/*.gcda
337 rm -rf coverage coverage-tcp coverage-all coverage-fallback
338
339 .PHONY: cleantests
340 cleantests:
341 rm -rf ./testtmp*
342
343 # We try to delete built files from both the source and build
344 # directories, just in case somebody previously configured things in
345 # the source directory.
346 .PHONY: distclean
347 distclean: clean
348 for dir in $(srcdir) . ; do \
349 (cd "$$dir" && rm -rf Makefile config.h config.status stunnel-rsyncd.conf \
350 lib/dummy popt/dummy zlib/dummy config.cache config.log shconfig \
351 $(GENFILES) autom4te.cache) ; \
352 done
353
354 # this target is really just for my use. It only works on a limited
355 # range of machines and is used to produce a list of potentially
356 # dead (ie. unused) functions in the code. (tridge)
357 .PHONY: finddead
358 finddead:
359 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
360 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
361 comm -13 nmused.txt nmfns.txt
362 @rm nmused.txt nmfns.txt
363
364 # 'check' is the GNU name, 'test' is the name for everybody else :-)
365 .PHONY: test
366 test: check
367
368 # There seems to be no standard way to specify some variables as
369 # exported from a Makefile apart from listing them like this.
370
371 # This depends on building rsync; if we need any helper programs it
372 # should depend on them too.
373
374 # We try to run the scripts with POSIX mode on, in the hope that will
375 # catch Bash-isms earlier even if we're running on GNU. Of course, we
376 # might lose in the future where POSIX diverges from old sh.
377
378 # `make check` runs tests in parallel by default. Override with
379 # `make check CHECK_J=1` (serial) or any other value.
380 CHECK_J = 8
381
382 # Parallelism for `make coverage`. Defaults to the same as CHECK_J: the
383 # coverage build sets -fprofile-update=atomic (atomic in-memory counters) and
384 # gcc's libgcov serializes the per-source .gcda read-modify-write merge with a
385 # file lock, so concurrent rsync processes (incl. the forked sender/generator/
386 # receiver) accumulate exactly -- verified by a count-linearity check (a hot
387 # line accumulates identically at -j1 and -P16). Override with
388 # `make coverage COVERAGE_J=1` if your libgcov does not lock .gcda merges.
389 COVERAGE_J = $(CHECK_J)
390
391 # Output directory and extra runtests.py flags for `make coverage`. The
392 # `coverage-tcp` target reuses the coverage recipe with --use-tcp (real
393 # loopback rsyncd, which exercises the TCP accept/auth path and the
394 # require_tcp-only tests) and a separate output directory.
395 COVERAGE_DIR = coverage
396 COVERAGE_RUNFLAGS =
397
398 # Excluded from the coverage report so the percentages reflect rsync's own
399 # runtime source. Three buckets:
400 # (1) Bundled third-party code rsync ships but does not own: zlib/, popt/, and
401 # the named lib/ imports (PostgreSQL getaddrinfo, ISC inet_ntop/inet_pton,
402 # standalone getpass). The other lib/*.c are rsync's own and stay in.
403 # (2) Test-helper / build-time programs that link against rsync objects but are
404 # not the rsync runtime: t_*.c, tls.c, wildtest.c, testrun.c, getgroups.c,
405 # getfsdev.c, trimslash.c, rounding.c. These have their own main() and are
406 # either driven directly by a test (counted there) or are configure-time
407 # probes; counting them as "rsync uncovered" is noise.
408 # (3) Compile-time-dead fallbacks under this build's config.h: lib/md5.c (the
409 # reference md5 -- openssl's EVP path is used when HAVE_OPENSSL) and
410 # lib/snprintf.c (only the #include line survives under
411 # HAVE_C99_VSNPRINTF). Covering these would mean a separate non-openssl /
412 # non-C99 build, which is out of scope for this report.
413 COVERAGE_EXCLUDE = -e '(^|/)zlib/' -e '(^|/)popt/' \
414 -e '(^|/)lib/(getaddrinfo|getpass|inet_ntop|inet_pton)\.' \
415 -e '(^|/)(t_[a-z_]+|tls|wildtest|testrun|getgroups|getfsdev|trimslash|rounding)\.c$$' \
416 -e '(^|/)lib/(md5|snprintf)\.c$$'
417
418 # Build everything the test suite needs (rsync + helper programs + symlinks)
419 # WITHOUT running it. Used by CI jobs that invoke runtests.py directly with
420 # custom options (e.g. the version-mix workflow's --rsync-bin2/--expect-result).
421 .PHONY: check-progs
422 check-progs: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
423
424 .PHONY: check
425 check: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
426 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(CHECK_J)
427
428 .PHONY: check29
429 check29: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
430 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(CHECK_J) --protocol=29
431
432 .PHONY: check30
433 check30: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
434 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(CHECK_J) --protocol=30
435
436 # Whole-suite gcov coverage report (HTML, with branch + decision coverage).
437 # Requires a build configured with --enable-coverage and the `gcovr` tool
438 # (pip install gcovr). Runs the suite in parallel (COVERAGE_J, default CHECK_J):
439 # this is safe because the coverage build uses -fprofile-update=atomic and
440 # libgcov locks the per-source .gcda during its merge, so concurrent rsync
441 # processes accumulate exactly (see COVERAGE_J above). Use COVERAGE_J=1 if your
442 # toolchain's libgcov does not lock .gcda merges.
443 .PHONY: coverage
444 coverage: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
445 @case '$(CFLAGS)' in *--coverage*) ;; \
446 *) echo "*** not a coverage build; reconfigure with --enable-coverage"; exit 1 ;; esac
447 @command -v gcovr >/dev/null 2>&1 || { echo "*** gcovr not found (pip install gcovr)"; exit 1; }
448 find . -name '*.gcda' -delete
449 @# Daemon modules with `uid = <non-root>` setuid the per-connection child
450 @# (and so the forked generator/receiver), which then cannot create or
451 @# merge .gcda files in a root-owned build dir -- silently dropping ALL
452 @# coverage from those processes. Make every .gcno's directory
453 @# world-writable so any uid can create the sibling .gcda, and set a
454 @# default ACL of o::rw so the .gcda are world-mergeable regardless of
455 @# the creator's umask (every test process resets umask to 022 via
456 @# rsyncfns.py, so a Makefile-level `umask 0` would not survive).
457 @find . -name '*.gcno' -printf '%h\n' 2>/dev/null | sort -u | \
458 while read d; do \
459 chmod a+rwx "$$d"; \
460 setfacl -m 'd:u::rwx,d:g::rwx,d:o::rwx' "$$d" 2>/dev/null || true; \
461 done
462 @rc=0; "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(COVERAGE_J) $(COVERAGE_RUNFLAGS) || rc=$$?; \
463 rm -rf $(COVERAGE_DIR) && mkdir -p $(COVERAGE_DIR); \
464 gcovr --root $(srcdir) $(COVERAGE_EXCLUDE) --decisions --print-summary \
465 --gcov-ignore-parse-errors=negative_hits.warn_once_per_file \
466 --html-details -o $(COVERAGE_DIR)/index.html . || exit $$?; \
467 echo "Coverage report written to $(COVERAGE_DIR)/index.html"; \
468 if test $$rc != 0; then \
469 echo "*** test suite FAILED (status $$rc) -- coverage report still written above"; \
470 fi; \
471 exit $$rc
472
473 # Same as `make coverage` but with the daemon tests run over a real loopback
474 # rsyncd (--use-tcp), into a separate report directory.
475 .PHONY: coverage-tcp
476 coverage-tcp:
477 $(MAKE) coverage COVERAGE_RUNFLAGS=--use-tcp COVERAGE_DIR=coverage-tcp
478
479 # Comprehensive single report: run the suite under several configurations,
480 # accumulating into the shared .gcda counters (NOT cleared between runs), then
481 # emit one merged, rsync-scoped report. Covers the default (pipe) transport, the
482 # protocol-29/30 compat branches, and the real-TCP daemon path (which also runs
483 # the require_tcp-only tests). Run under sudo to additionally cover root-only
484 # paths (devices, chown, use-chroot, protected-regular). Local target -- CI uses
485 # the plain `coverage`/`coverage-tcp` targets.
486 .PHONY: coverage-all
487 coverage-all: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
488 @case '$(CFLAGS)' in *--coverage*) ;; \
489 *) echo "*** not a coverage build; reconfigure with --enable-coverage"; exit 1 ;; esac
490 @command -v gcovr >/dev/null 2>&1 || { echo "*** gcovr not found (pip install gcovr)"; exit 1; }
491 find . -name '*.gcda' -delete
492 @# See the `coverage` target above for why: setuid'd daemon children must
493 @# be able to create/merge .gcda owned by a different uid.
494 @find . -name '*.gcno' -printf '%h\n' 2>/dev/null | sort -u | \
495 while read d; do \
496 chmod a+rwx "$$d"; \
497 setfacl -m 'd:u::rwx,d:g::rwx,d:o::rwx' "$$d" 2>/dev/null || true; \
498 done
499 @rc=0; \
500 for cfg in '' '--protocol=30' '--protocol=29' '--use-tcp'; do \
501 echo "===== coverage-all: runtests.py $$cfg ====="; \
502 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(COVERAGE_J) $$cfg || rc=$$?; \
503 done; \
504 rm -rf coverage-all && mkdir -p coverage-all; \
505 gcovr --root $(srcdir) $(COVERAGE_EXCLUDE) --decisions --print-summary \
506 --gcov-ignore-parse-errors=negative_hits.warn_once_per_file \
507 --html-details -o coverage-all/index.html . || exit $$?; \
508 echo "Merged coverage report written to coverage-all/index.html"; \
509 if test $$rc != 0; then \
510 echo "*** some suite runs FAILED (status $$rc) -- report still written above"; \
511 fi; \
512 exit $$rc
513
514 # Coverage for the portable (non-openat2) resolver tier. Requires a SEPARATE
515 # build configured with --enable-coverage --disable-openat2: its .gcno differ
516 # from the openat2 build, so this report cannot be merged with the others.
517 .PHONY: coverage-fallback
518 coverage-fallback:
519 $(MAKE) coverage COVERAGE_DIR=coverage-fallback
520
521 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
522 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
523 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
524
525 simdtest$(EXEEXT): simd-checksum-x86_64.cpp $(HEADERS)
526 @if test x"@ROLL_SIMD@" != x; then \
527 $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -DTEST_SIMD_CHECKSUM1 \
528 -o $@ $(srcdir)/simd-checksum-x86_64.cpp @ROLL_ASM@ $(LIBS); \
529 else \
530 touch $@; \
531 fi
532
533 testsuite/chown-fake_test.py:
534 ln -s chown_test.py $(srcdir)/testsuite/chown-fake_test.py
535
536 testsuite/devices-fake_test.py:
537 ln -s devices_test.py $(srcdir)/testsuite/devices-fake_test.py
538
539 testsuite/xattrs-hlink_test.py:
540 ln -s xattrs_test.py $(srcdir)/testsuite/xattrs-hlink_test.py
541
542 testsuite/exclude-lsh_test.py:
543 ln -s exclude_test.py $(srcdir)/testsuite/exclude-lsh_test.py
544
545 # This does *not* depend on building or installing: you can use it to
546 # check a version installed from a binary or some other source tree,
547 # if you want.
548
549 .PHONY: installcheck
550 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
551 "$(srcdir)/runtests.py" --rsync-bin="$(bindir)/rsync$(EXEEXT)" --srcdir="$(srcdir)" --tooldir="`pwd`" -j $(CHECK_J)
552
553 # TODO: Add 'dist' target; need to know which files will be included
554
555 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
556 .PHONY: splint
557 splint:
558 splint +unixlib +gnuextensions -weak rsync.c
559
560 .PHONY: doxygen
561 doxygen:
562 cd $(srcdir) && rm dox/html/* && doxygen
563
564 # for maintainers only
565 .PHONY: doxygen-upload
566 doxygen-upload:
567 rsync -avzv $(srcdir)/dox/html/ --delete \
568 $${RSYNC_SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/