Debian Codegraph @

Makefile.in

raw ◀ ▶
Source reconstructed at patch state 0 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 @if test -f configure.sh.old || test -f config.h.in.old; then \
289 if test "$(MAKECMDGOALS)" = reconfigure; then \
290 echo 'Continuing with "make reconfigure".'; \
291 else \
292 echo 'You may need to run:'; \
293 echo ' make reconfigure'; \
294 exit 1; \
295 fi \
296 fi
297
298 .PHONY: reconfigure
299 reconfigure: configure.sh
300 ./config.status --recheck
301 ./config.status
302
303 .PHONY: restatus
304 restatus:
305 ./config.status
306
307 Makefile: Makefile.in config.status configure.sh config.h.in
308 @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
309 @./config.status
310 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
311 echo "Makefile is unchanged."; \
312 rm Makefile.old; \
313 else \
314 if test "$(MAKECMDGOALS)" = reconfigure; then \
315 echo 'Continuing with "make reconfigure".'; \
316 else \
317 echo "Makefile updated -- rerun your make command."; \
318 exit 1; \
319 fi \
320 fi
321
322 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
323 sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
324
325 .PHONY: proto
326 proto: proto.h-tstamp
327
328 proto.h: proto.h-tstamp
329 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
330
331 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c daemon-parm.h
332 $(AWK) -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c daemon-parm.h
333
334 .PHONY: man
335 man: rsync.1 rsync-ssl.1 rsyncd.conf.5 @MAKE_RRSYNC_1@
336
337 rsync.1: rsync.1.md md-convert version.h Makefile
338 @$(srcdir)/maybe-make-man rsync.1.md
339
340 rsync-ssl.1: rsync-ssl.1.md md-convert version.h Makefile
341 @$(srcdir)/maybe-make-man rsync-ssl.1.md
342
343 rsyncd.conf.5: rsyncd.conf.5.md md-convert version.h Makefile
344 @$(srcdir)/maybe-make-man rsyncd.conf.5.md
345
346 rrsync.1: support/rrsync.1.md md-convert Makefile
347 @$(srcdir)/maybe-make-man support/rrsync.1.md
348
349 .PHONY: clean
350 clean: cleantests
351 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS) @MAKE_RRSYNC@ \
352 git-version.h rounding rounding.h *.old rsync*.1 rsync*.5 @MAKE_RRSYNC_1@ \
353 *.html daemon-parm.h help-*.h default-*.h proto.h proto.h-tstamp
354 rm -f *.gcno *.gcda lib/*.gcno lib/*.gcda zlib/*.gcno zlib/*.gcda popt/*.gcno popt/*.gcda
355 rm -rf coverage coverage-tcp coverage-all coverage-fallback
356
357 .PHONY: cleantests
358 cleantests:
359 rm -rf ./testtmp*
360
361 # We try to delete built files from both the source and build
362 # directories, just in case somebody previously configured things in
363 # the source directory.
364 .PHONY: distclean
365 distclean: clean
366 for dir in $(srcdir) . ; do \
367 (cd "$$dir" && rm -rf Makefile config.h config.status stunnel-rsyncd.conf \
368 lib/dummy popt/dummy zlib/dummy config.cache config.log shconfig \
369 $(GENFILES) autom4te.cache) ; \
370 done
371
372 # this target is really just for my use. It only works on a limited
373 # range of machines and is used to produce a list of potentially
374 # dead (ie. unused) functions in the code. (tridge)
375 .PHONY: finddead
376 finddead:
377 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
378 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
379 comm -13 nmused.txt nmfns.txt
380 @rm nmused.txt nmfns.txt
381
382 # 'check' is the GNU name, 'test' is the name for everybody else :-)
383 .PHONY: test
384 test: check
385
386 # There seems to be no standard way to specify some variables as
387 # exported from a Makefile apart from listing them like this.
388
389 # This depends on building rsync; if we need any helper programs it
390 # should depend on them too.
391
392 # We try to run the scripts with POSIX mode on, in the hope that will
393 # catch Bash-isms earlier even if we're running on GNU. Of course, we
394 # might lose in the future where POSIX diverges from old sh.
395
396 # `make check` runs tests in parallel by default. Override with
397 # `make check CHECK_J=1` (serial) or any other value.
398 CHECK_J = 8
399
400 # Parallelism for `make coverage`. Defaults to the same as CHECK_J: the
401 # coverage build sets -fprofile-update=atomic (atomic in-memory counters) and
402 # gcc's libgcov serializes the per-source .gcda read-modify-write merge with a
403 # file lock, so concurrent rsync processes (incl. the forked sender/generator/
404 # receiver) accumulate exactly -- verified by a count-linearity check (a hot
405 # line accumulates identically at -j1 and -P16). Override with
406 # `make coverage COVERAGE_J=1` if your libgcov does not lock .gcda merges.
407 COVERAGE_J = $(CHECK_J)
408
409 # Output directory and extra runtests.py flags for `make coverage`. The
410 # `coverage-tcp` target reuses the coverage recipe with --use-tcp (real
411 # loopback rsyncd, which exercises the TCP accept/auth path and the
412 # require_tcp-only tests) and a separate output directory.
413 COVERAGE_DIR = coverage
414 COVERAGE_RUNFLAGS =
415
416 # Excluded from the coverage report so the percentages reflect rsync's own
417 # runtime source. Three buckets:
418 # (1) Bundled third-party code rsync ships but does not own: zlib/, popt/, and
419 # the named lib/ imports (PostgreSQL getaddrinfo, ISC inet_ntop/inet_pton,
420 # standalone getpass). The other lib/*.c are rsync's own and stay in.
421 # (2) Test-helper / build-time programs that link against rsync objects but are
422 # not the rsync runtime: t_*.c, tls.c, wildtest.c, testrun.c, getgroups.c,
423 # getfsdev.c, trimslash.c, rounding.c. These have their own main() and are
424 # either driven directly by a test (counted there) or are configure-time
425 # probes; counting them as "rsync uncovered" is noise.
426 # (3) Compile-time-dead fallbacks under this build's config.h: lib/md5.c (the
427 # reference md5 -- openssl's EVP path is used when HAVE_OPENSSL) and
428 # lib/snprintf.c (only the #include line survives under
429 # HAVE_C99_VSNPRINTF). Covering these would mean a separate non-openssl /
430 # non-C99 build, which is out of scope for this report.
431 COVERAGE_EXCLUDE = -e '(^|/)zlib/' -e '(^|/)popt/' \
432 -e '(^|/)lib/(getaddrinfo|getpass|inet_ntop|inet_pton)\.' \
433 -e '(^|/)(t_[a-z_]+|tls|wildtest|testrun|getgroups|getfsdev|trimslash|rounding)\.c$$' \
434 -e '(^|/)lib/(md5|snprintf)\.c$$'
435
436 # Build everything the test suite needs (rsync + helper programs + symlinks)
437 # WITHOUT running it. Used by CI jobs that invoke runtests.py directly with
438 # custom options (e.g. the version-mix workflow's --rsync-bin2/--expect-result).
439 .PHONY: check-progs
440 check-progs: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
441
442 .PHONY: check
443 check: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
444 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(CHECK_J)
445
446 .PHONY: check29
447 check29: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
448 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(CHECK_J) --protocol=29
449
450 .PHONY: check30
451 check30: all $(CHECK_PROGS) $(CHECK_COMPILE_OBJS) $(CHECK_SYMLINKS)
452 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(CHECK_J) --protocol=30
453
454 # Whole-suite gcov coverage report (HTML, with branch + decision coverage).
455 # Requires a build configured with --enable-coverage and the `gcovr` tool
456 # (pip install gcovr). Runs the suite in parallel (COVERAGE_J, default CHECK_J):
457 # this is safe because the coverage build uses -fprofile-update=atomic and
458 # libgcov locks the per-source .gcda during its merge, so concurrent rsync
459 # processes accumulate exactly (see COVERAGE_J above). Use COVERAGE_J=1 if your
460 # toolchain's libgcov does not lock .gcda merges.
461 .PHONY: coverage
462 coverage: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
463 @case '$(CFLAGS)' in *--coverage*) ;; \
464 *) echo "*** not a coverage build; reconfigure with --enable-coverage"; exit 1 ;; esac
465 @command -v gcovr >/dev/null 2>&1 || { echo "*** gcovr not found (pip install gcovr)"; exit 1; }
466 find . -name '*.gcda' -delete
467 @# Daemon modules with `uid = <non-root>` setuid the per-connection child
468 @# (and so the forked generator/receiver), which then cannot create or
469 @# merge .gcda files in a root-owned build dir -- silently dropping ALL
470 @# coverage from those processes. Make every .gcno's directory
471 @# world-writable so any uid can create the sibling .gcda, and set a
472 @# default ACL of o::rw so the .gcda are world-mergeable regardless of
473 @# the creator's umask (every test process resets umask to 022 via
474 @# rsyncfns.py, so a Makefile-level `umask 0` would not survive).
475 @find . -name '*.gcno' -printf '%h\n' 2>/dev/null | sort -u | \
476 while read d; do \
477 chmod a+rwx "$$d"; \
478 setfacl -m 'd:u::rwx,d:g::rwx,d:o::rwx' "$$d" 2>/dev/null || true; \
479 done
480 @rc=0; "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(COVERAGE_J) $(COVERAGE_RUNFLAGS) || rc=$$?; \
481 rm -rf $(COVERAGE_DIR) && mkdir -p $(COVERAGE_DIR); \
482 gcovr --root $(srcdir) $(COVERAGE_EXCLUDE) --decisions --print-summary \
483 --gcov-ignore-parse-errors=negative_hits.warn_once_per_file \
484 --html-details -o $(COVERAGE_DIR)/index.html . || exit $$?; \
485 echo "Coverage report written to $(COVERAGE_DIR)/index.html"; \
486 if test $$rc != 0; then \
487 echo "*** test suite FAILED (status $$rc) -- coverage report still written above"; \
488 fi; \
489 exit $$rc
490
491 # Same as `make coverage` but with the daemon tests run over a real loopback
492 # rsyncd (--use-tcp), into a separate report directory.
493 .PHONY: coverage-tcp
494 coverage-tcp:
495 $(MAKE) coverage COVERAGE_RUNFLAGS=--use-tcp COVERAGE_DIR=coverage-tcp
496
497 # Comprehensive single report: run the suite under several configurations,
498 # accumulating into the shared .gcda counters (NOT cleared between runs), then
499 # emit one merged, rsync-scoped report. Covers the default (pipe) transport, the
500 # protocol-29/30 compat branches, and the real-TCP daemon path (which also runs
501 # the require_tcp-only tests). Run under sudo to additionally cover root-only
502 # paths (devices, chown, use-chroot, protected-regular). Local target -- CI uses
503 # the plain `coverage`/`coverage-tcp` targets.
504 .PHONY: coverage-all
505 coverage-all: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
506 @case '$(CFLAGS)' in *--coverage*) ;; \
507 *) echo "*** not a coverage build; reconfigure with --enable-coverage"; exit 1 ;; esac
508 @command -v gcovr >/dev/null 2>&1 || { echo "*** gcovr not found (pip install gcovr)"; exit 1; }
509 find . -name '*.gcda' -delete
510 @# See the `coverage` target above for why: setuid'd daemon children must
511 @# be able to create/merge .gcda owned by a different uid.
512 @find . -name '*.gcno' -printf '%h\n' 2>/dev/null | sort -u | \
513 while read d; do \
514 chmod a+rwx "$$d"; \
515 setfacl -m 'd:u::rwx,d:g::rwx,d:o::rwx' "$$d" 2>/dev/null || true; \
516 done
517 @rc=0; \
518 for cfg in '' '--protocol=30' '--protocol=29' '--use-tcp'; do \
519 echo "===== coverage-all: runtests.py $$cfg ====="; \
520 "$(srcdir)/runtests.py" --rsync-bin="`pwd`/rsync$(EXEEXT)" -j $(COVERAGE_J) $$cfg || rc=$$?; \
521 done; \
522 rm -rf coverage-all && mkdir -p coverage-all; \
523 gcovr --root $(srcdir) $(COVERAGE_EXCLUDE) --decisions --print-summary \
524 --gcov-ignore-parse-errors=negative_hits.warn_once_per_file \
525 --html-details -o coverage-all/index.html . || exit $$?; \
526 echo "Merged coverage report written to coverage-all/index.html"; \
527 if test $$rc != 0; then \
528 echo "*** some suite runs FAILED (status $$rc) -- report still written above"; \
529 fi; \
530 exit $$rc
531
532 # Coverage for the portable (non-openat2) resolver tier. Requires a SEPARATE
533 # build configured with --enable-coverage --disable-openat2: its .gcno differ
534 # from the openat2 build, so this report cannot be merged with the others.
535 .PHONY: coverage-fallback
536 coverage-fallback:
537 $(MAKE) coverage COVERAGE_DIR=coverage-fallback
538
539 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
540 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
541 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
542
543 simdtest$(EXEEXT): simd-checksum-x86_64.cpp $(HEADERS)
544 @if test x"@ROLL_SIMD@" != x; then \
545 $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -DTEST_SIMD_CHECKSUM1 \
546 -o $@ $(srcdir)/simd-checksum-x86_64.cpp @ROLL_ASM@ $(LIBS); \
547 else \
548 touch $@; \
549 fi
550
551 testsuite/chown-fake_test.py:
552 ln -s chown_test.py $(srcdir)/testsuite/chown-fake_test.py
553
554 testsuite/devices-fake_test.py:
555 ln -s devices_test.py $(srcdir)/testsuite/devices-fake_test.py
556
557 testsuite/xattrs-hlink_test.py:
558 ln -s xattrs_test.py $(srcdir)/testsuite/xattrs-hlink_test.py
559
560 testsuite/exclude-lsh_test.py:
561 ln -s exclude_test.py $(srcdir)/testsuite/exclude-lsh_test.py
562
563 # This does *not* depend on building or installing: you can use it to
564 # check a version installed from a binary or some other source tree,
565 # if you want.
566
567 .PHONY: installcheck
568 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
569 "$(srcdir)/runtests.py" --rsync-bin="$(bindir)/rsync$(EXEEXT)" --srcdir="$(srcdir)" --tooldir="`pwd`" -j $(CHECK_J)
570
571 # TODO: Add 'dist' target; need to know which files will be included
572
573 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
574 .PHONY: splint
575 splint:
576 splint +unixlib +gnuextensions -weak rsync.c
577
578 .PHONY: doxygen
579 doxygen:
580 cd $(srcdir) && rm dox/html/* && doxygen
581
582 # for maintainers only
583 .PHONY: doxygen-upload
584 doxygen-upload:
585 rsync -avzv $(srcdir)/dox/html/ --delete \
586 $${RSYNC_SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/