Debian Codegraph @

Makefile.in

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