update to popt 1.19
[rsync.git] / Makefile.in
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 @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         util1.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         usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
50 OBJS3=progress.o pipe.o @MD5_ASM@ @ROLL_SIMD@ @ROLL_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 popt/poptint.o
54 OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
55
56 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@
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 # NOTE: consider running "packaging/smart-make" instead of "make" to auto-handle
74 # any changes to configure.sh and the main Makefile prior to a "make all".
75 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_RRSYNC@ @MAKE_MAN@
76 .PHONY: all
77
78 .PHONY: install
79 install: all
80         -$(MKDIR_P) $(DESTDIR)$(bindir)
81         $(INSTALLCMD) $(INSTALL_STRIP) -m 755 rsync$(EXEEXT) $(DESTDIR)$(bindir)
82         $(INSTALLCMD) -m 755 $(srcdir)/rsync-ssl $(DESTDIR)$(bindir)
83         -$(MKDIR_P) $(DESTDIR)$(mandir)/man1
84         -$(MKDIR_P) $(DESTDIR)$(mandir)/man5
85         if test -f rsync.1; then $(INSTALLMAN) -m 644 rsync.1 $(DESTDIR)$(mandir)/man1; fi
86         if test -f rsync-ssl.1; then $(INSTALLMAN) -m 644 rsync-ssl.1 $(DESTDIR)$(mandir)/man1; fi
87         if test -f rsyncd.conf.5; then $(INSTALLMAN) -m 644 rsyncd.conf.5 $(DESTDIR)$(mandir)/man5; fi
88         if test "$(with_rrsync)" = yes; then \
89             $(INSTALLCMD) -m 755 rrsync $(DESTDIR)$(bindir); \
90             if test -f rrsync.1; then $(INSTALLMAN) -m 644 rrsync.1 $(DESTDIR)$(mandir)/man1; fi; \
91         fi
92
93 install-ssl-daemon: stunnel-rsyncd.conf
94         -$(MKDIR_P) $(DESTDIR)/etc/stunnel
95         $(INSTALLCMD) -m 644 stunnel-rsyncd.conf $(DESTDIR)/etc/stunnel/rsyncd.conf
96         @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
97             echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
98         fi
99
100 install-all: install install-ssl-daemon
101
102 install-strip:
103         $(MAKE) INSTALL_STRIP='-s' install
104
105 rsync$(EXEEXT): $(OBJS)
106         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
107
108 rrsync: support/rrsync
109         cp -p $(srcdir)/support/rrsync rrsync
110
111 $(OBJS): $(HEADERS)
112 $(CHECK_OBJS): $(HEADERS)
113 tls.o xattrs.o: lib/sysxattrs.h
114 usage.o: version.h latest-year.h help-rsync.h help-rsyncd.h git-version.h default-cvsignore.h
115 loadparm.o: default-dont-compress.h daemon-parm.h
116
117 flist.o: rounding.h
118
119 default-cvsignore.h default-dont-compress.h: rsync.1.md define-from-md.awk
120         $(AWK) -f $(srcdir)/define-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
121
122 help-rsync.h help-rsyncd.h: rsync.1.md help-from-md.awk
123         $(AWK) -f $(srcdir)/help-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
124
125 daemon-parm.h: daemon-parm.txt daemon-parm.awk
126         $(AWK) -f $(srcdir)/daemon-parm.awk $(srcdir)/daemon-parm.txt
127
128 rounding.h: rounding.c rsync.h proto.h
129         @for r in 0 1 3; do \
130             if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
131                 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
132                 if test -f "$$HOME/build_farm/build_test.fns"; then \
133                     echo "EXTRA_ROUNDING is $$r" >&2; \
134                 fi; \
135                 break; \
136             fi; \
137         done
138         @rm -f rounding
139         @if test -f rounding.h; then : ; else \
140             cat rounding.out 1>&2; \
141             echo "Failed to create rounding.h!" 1>&2; \
142             exit 1; \
143         fi
144         @rm -f rounding.out
145
146 git-version.h: ALWAYS_RUN
147         $(srcdir)/mkgitver
148
149 .PHONY: ALWAYS_RUN
150 ALWAYS_RUN:
151
152 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
153         @$(srcdir)/cmd-or-msg disable-roll-simd $(CXX) -I. $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
154
155 simd-checksum-avx2.o: simd-checksum-avx2.S
156         @$(srcdir)/cmd-or-msg disable-roll-asm $(CC) $(CFLAGS) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/simd-checksum-avx2.S
157
158 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.S lib/md-defines.h
159         @$(srcdir)/cmd-or-msg disable-md5-asm $(CC) -I. @NOEXECSTACK@ -c -o $@ $(srcdir)/lib/md5-asm-x86_64.S
160
161 tls$(EXEEXT): $(TLS_OBJ)
162         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
163
164 testrun$(EXEEXT): testrun.o
165         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
166
167 getgroups$(EXEEXT): getgroups.o
168         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
169
170 getfsdev$(EXEEXT): getfsdev.o
171         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
172
173 TRIMSLASH_OBJ = trimslash.o syscall.o util2.o t_stub.o lib/compat.o lib/snprintf.o
174 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
175         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
176
177 T_UNSAFE_OBJ = t_unsafe.o syscall.o util1.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
178 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
179         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
180
181 .PHONY: conf
182 conf: configure.sh config.h.in
183
184 .PHONY: gen
185 gen: conf proto.h man git-version.h
186
187 .PHONY: gensend
188 gensend: gen
189         if ! diff git-version.h $(srcdir)/gists/rsync-git-version.h >/dev/null; then \
190             ./rsync -ai git-version.h $(srcdir)/gists/rsync-git-version.h && \
191             (cd $(srcdir)/gists && git commit --allow-empty-message -m '' rsync-git-version.h && git push) ; \
192         fi
193         rsync -aic $(GENFILES) git-version.h $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/ || true
194
195 aclocal.m4: $(srcdir)/m4/*.m4
196         aclocal -I $(srcdir)/m4
197
198 configure.sh config.h.in: configure.ac aclocal.m4
199         @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
200         @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
201         autoconf -o configure.sh
202         autoheader && touch config.h.in
203         @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
204             echo "configure.sh is unchanged."; \
205             rm configure.sh.old; \
206         else \
207             echo "configure.sh has CHANGED."; \
208         fi
209         @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
210             echo "config.h.in is unchanged."; \
211             rm config.h.in.old; \
212         else \
213             echo "config.h.in has CHANGED."; \
214         fi
215         @if test -f configure.sh.old || test -f config.h.in.old; then \
216             if test "$(MAKECMDGOALS)" = reconfigure; then \
217                 echo 'Continuing with "make reconfigure".'; \
218             else \
219                 echo 'You may need to run:'; \
220                 echo '  make reconfigure'; \
221                 exit 1; \
222             fi \
223         fi
224
225 .PHONY: reconfigure
226 reconfigure: configure.sh
227         ./config.status --recheck
228         ./config.status
229
230 .PHONY: restatus
231 restatus:
232         ./config.status
233
234 Makefile: Makefile.in config.status configure.sh config.h.in
235         @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
236         @./config.status
237         @if diff Makefile Makefile.old >/dev/null 2>&1; then \
238             echo "Makefile is unchanged."; \
239             rm Makefile.old; \
240         else \
241             if test "$(MAKECMDGOALS)" = reconfigure; then \
242                 echo 'Continuing with "make reconfigure".'; \
243             else \
244                 echo "Makefile updated -- rerun your make command."; \
245                 exit 1; \
246             fi \
247         fi
248
249 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
250         sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
251
252 .PHONY: proto
253 proto: proto.h-tstamp
254
255 proto.h: proto.h-tstamp
256         @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
257
258 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c daemon-parm.h
259         $(AWK) -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c daemon-parm.h
260
261 .PHONY: man
262 man: rsync.1 rsync-ssl.1 rsyncd.conf.5 @MAKE_RRSYNC_1@
263
264 rsync.1: rsync.1.md md-convert version.h Makefile
265         @$(srcdir)/maybe-make-man rsync.1.md
266
267 rsync-ssl.1: rsync-ssl.1.md md-convert version.h Makefile
268         @$(srcdir)/maybe-make-man rsync-ssl.1.md
269
270 rsyncd.conf.5: rsyncd.conf.5.md md-convert version.h Makefile
271         @$(srcdir)/maybe-make-man rsyncd.conf.5.md
272
273 rrsync.1: support/rrsync.1.md md-convert Makefile
274         @$(srcdir)/maybe-make-man support/rrsync.1.md
275
276 .PHONY: clean
277 clean: cleantests
278         rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) @MAKE_RRSYNC@ \
279                 git-version.h rounding rounding.h *.old rsync*.1 rsync*.5 @MAKE_RRSYNC_1@ \
280                 *.html daemon-parm.h help-*.h default-*.h proto.h proto.h-tstamp
281
282 .PHONY: cleantests
283 cleantests:
284         rm -rf ./testtmp*
285
286 # We try to delete built files from both the source and build
287 # directories, just in case somebody previously configured things in
288 # the source directory.
289 .PHONY: distclean
290 distclean: clean
291         for dir in $(srcdir) . ; do \
292             (cd "$$dir" && rm -rf Makefile config.h config.status stunnel-rsyncd.conf \
293              lib/dummy popt/dummy zlib/dummy config.cache config.log shconfig \
294              $(GENFILES) autom4te.cache) ; \
295         done
296
297 # this target is really just for my use. It only works on a limited
298 # range of machines and is used to produce a list of potentially
299 # dead (ie. unused) functions in the code. (tridge)
300 .PHONY: finddead
301 finddead:
302         nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
303         nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
304         comm -13 nmused.txt nmfns.txt
305         @rm nmused.txt nmfns.txt
306
307 # 'check' is the GNU name, 'test' is the name for everybody else :-)
308 .PHONY: test
309 test: check
310
311 # There seems to be no standard way to specify some variables as
312 # exported from a Makefile apart from listing them like this.
313
314 # This depends on building rsync; if we need any helper programs it
315 # should depend on them too.
316
317 # We try to run the scripts with POSIX mode on, in the hope that will
318 # catch Bash-isms earlier even if we're running on GNU.  Of course, we
319 # might lose in the future where POSIX diverges from old sh.
320
321 .PHONY: check
322 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
323         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
324
325 .PHONY: check29
326 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
327         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
328
329 .PHONY: check30
330 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
331         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
332
333 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
334 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
335         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
336
337 testsuite/chown-fake.test:
338         ln -s chown.test $(srcdir)/testsuite/chown-fake.test
339
340 testsuite/devices-fake.test:
341         ln -s devices.test $(srcdir)/testsuite/devices-fake.test
342
343 testsuite/xattrs-hlink.test:
344         ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
345
346 # This does *not* depend on building or installing: you can use it to
347 # check a version installed from a binary or some other source tree,
348 # if you want.
349
350 .PHONY: installcheck
351 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
352         POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
353
354 # TODO: Add 'dist' target; need to know which files will be included
355
356 # Run the SPLINT (Secure Programming Lint) tool.  <www.splint.org>
357 .PHONY: splint
358 splint:
359         splint +unixlib +gnuextensions -weak rsync.c
360
361 .PHONY: doxygen
362 doxygen:
363         cd $(srcdir) && rm dox/html/* && doxygen
364
365 # for maintainers only
366 .PHONY: doxygen-upload
367 doxygen-upload:
368         rsync -avzv $(srcdir)/dox/html/ --delete \
369         $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/