We need to use nawk or gawk on Solaris, not their weird awk.
[rsync.git] / Makefile.in
1 # Makefile for rsync. This is processed by configure to produce the final
2 # Makefile
3
4 prefix=@prefix@
5 datarootdir=@datarootdir@
6 exec_prefix=@exec_prefix@
7 bindir=@bindir@
8 libdir=@libdir@/rsync
9 mandir=@mandir@
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 VERSION=@RSYNC_VERSION@
31
32 .SUFFIXES:
33 .SUFFIXES: .c .o
34
35 SIMD_x86_64=simd-checksum-x86_64.o lib/md5-asm-x86_64.o
36
37 GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsync.1.html \
38          rsync-ssl.1 rsync-ssl.1.html rsyncd.conf.5 rsyncd.conf.5.html
39 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
40         lib/pool_alloc.h
41 LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
42         lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@
43 zlib_OBJS=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
44         zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
45 OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
46         util.o util2.o main.o checksum.o match.o syscall.o log.o backup.o delete.o
47 OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
48         fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
49 OBJS3=progress.o pipe.o
50 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
51 popt_OBJS=popt/findme.o  popt/popt.o  popt/poptconfig.o \
52         popt/popthelp.o popt/poptparse.o
53 OBJS=$(OBJS1) $(OBJS2) $(OBJS3) @SIMD@ $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
54
55 TLS_OBJ = tls.o syscall.o t_stub.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
56
57 # Programs we must have to run the test cases
58 CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
59         testrun$(EXEEXT) trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
60
61 CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test testsuite/xattrs-hlink.test
62
63 # Objects for CHECK_PROGS to clean
64 CHECK_OBJS=tls.o testrun.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
65
66 # note that the -I. is needed to handle config.h when using VPATH
67 .c.o:
68 @OBJ_SAVE@
69         $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
70 @OBJ_RESTORE@
71
72 .PHONY: all
73 all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_MAN@
74
75 .PHONY: install
76 install: all
77         -${MKDIR_P} ${DESTDIR}${bindir}
78         ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
79         ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir}
80         -${MKDIR_P} ${DESTDIR}${mandir}/man1
81         -${MKDIR_P} ${DESTDIR}${mandir}/man5
82         if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi
83         if test -f rsync-ssl.1; then ${INSTALLMAN} -m 644 rsync-ssl.1 ${DESTDIR}${mandir}/man1; fi
84         if test -f rsyncd.conf.5; then ${INSTALLMAN} -m 644 rsyncd.conf.5 ${DESTDIR}${mandir}/man5; fi
85
86 install-ssl-daemon: stunnel-rsyncd.conf
87         -${MKDIR_P} ${DESTDIR}/etc/stunnel
88         ${INSTALLCMD} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf
89         @if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
90             echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
91         fi
92
93 install-all: install install-ssl-client install-ssl-daemon
94
95 install-strip:
96         $(MAKE) INSTALL_STRIP='-s' install
97
98 rsync$(EXEEXT): $(OBJS)
99         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
100
101 $(OBJS): $(HEADERS)
102 $(CHECK_OBJS): $(HEADERS)
103 options.o: latest-year.h help-rsync.h help-rsyncd.h
104 exclude.o: default-cvsignore.h
105 loadparm.o: default-dont-compress.h
106
107 flist.o: rounding.h
108
109 default-cvsignore.h default-dont-compress.h: rsync.1.md define-from-md.awk
110         $(AWK) -f $(srcdir)/define-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
111
112 help-rsync.h help-rsyncd.h: rsync.1.md help-from-md.awk
113         $(AWK) -f $(srcdir)/help-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
114
115 rounding.h: rounding.c rsync.h proto.h
116         @for r in 0 1 3; do \
117             if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
118                 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
119                 if test -f "$$HOME/build_farm/build_test.fns"; then \
120                     echo "EXTRA_ROUNDING is $$r" >&2; \
121                 fi; \
122                 break; \
123             fi; \
124         done
125         @rm -f rounding
126         @if test -f rounding.h; then : ; else \
127             cat rounding.out 1>&2; \
128             echo "Failed to create rounding.h!" 1>&2; \
129             exit 1; \
130         fi
131         @rm -f rounding.out
132
133 simd-checksum-x86_64.o: simd-checksum-x86_64.cpp
134         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $(srcdir)/simd-checksum-x86_64.cpp
135
136 lib/md5-asm-x86_64.o: lib/md5-asm-x86_64.s
137         $(CC) -c -o $@ $(srcdir)/lib/md5-asm-x86_64.s
138
139 tls$(EXEEXT): $(TLS_OBJ)
140         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
141
142 testrun$(EXEEXT): testrun.o
143         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ testrun.o
144
145 getgroups$(EXEEXT): getgroups.o
146         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
147
148 getfsdev$(EXEEXT): getfsdev.o
149         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
150
151 TRIMSLASH_OBJ = trimslash.o syscall.o t_stub.o lib/compat.o lib/snprintf.o
152 trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
153         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
154
155 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o util2.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
156 t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
157         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
158
159 .PHONY: conf
160 conf: configure.sh config.h.in
161
162 .PHONY: gen
163 gen: conf proto.h man
164
165 .PHONY: gensend
166 gensend: gen
167         rsync -aic $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
168
169 aclocal.m4: $(srcdir)/m4/*.m4
170         aclocal -I $(srcdir)/m4
171
172 configure.sh config.h.in: configure.ac aclocal.m4
173         @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
174         @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
175         autoconf -o configure.sh
176         autoheader && touch config.h.in
177         @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
178             echo "configure.sh is unchanged."; \
179             rm configure.sh.old; \
180         else \
181             echo "configure.sh has CHANGED."; \
182         fi
183         @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
184             echo "config.h.in is unchanged."; \
185             rm config.h.in.old; \
186         else \
187             echo "config.h.in has CHANGED."; \
188         fi
189         @if test -f configure.sh.old -o -f config.h.in.old; then \
190             if test "$(MAKECMDGOALS)" = reconfigure; then \
191                 echo 'Continuing with "make reconfigure".'; \
192             else \
193                 echo 'You may need to run:'; \
194                 echo '  make reconfigure'; \
195                 exit 1; \
196             fi \
197         fi
198
199 .PHONY: reconfigure
200 reconfigure: configure.sh
201         ./config.status --recheck
202         ./config.status
203
204 Makefile: Makefile.in config.status configure.sh config.h.in
205         @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
206         @./config.status
207         @if diff Makefile Makefile.old >/dev/null 2>&1; then \
208             echo "Makefile is unchanged."; \
209             rm Makefile.old; \
210         else \
211             if test "$(MAKECMDGOALS)" = reconfigure; then \
212                 echo 'Continuing with "make reconfigure".'; \
213             else \
214                 echo "Makefile updated -- rerun your make command."; \
215                 exit 1; \
216             fi \
217         fi
218
219 stunnel-rsyncd.conf: $(srcdir)/stunnel-rsyncd.conf.in Makefile
220         sed 's;\@bindir\@;$(bindir);g' <$(srcdir)/stunnel-rsyncd.conf.in >stunnel-rsyncd.conf
221
222 .PHONY: proto
223 proto: proto.h-tstamp
224
225 proto.h: proto.h-tstamp
226         @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
227
228 proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c config.h
229         $(AWK) -f $(srcdir)/mkproto.awk $(srcdir)/*.c $(srcdir)/lib/compat.c
230
231 .PHONY: man
232 man: rsync.1 rsync-ssl.1 rsyncd.conf.5
233
234 rsync.1: rsync.1.md md2man NEWS.md Makefile
235         @$(srcdir)/maybe-make-man $(srcdir) rsync.1.md
236
237 rsync-ssl.1: rsync-ssl.1.md md2man NEWS.md Makefile
238         @$(srcdir)/maybe-make-man $(srcdir) rsync-ssl.1.md
239
240 rsyncd.conf.5: rsyncd.conf.5.md md2man NEWS.md Makefile
241         @$(srcdir)/maybe-make-man $(srcdir) rsyncd.conf.5.md
242
243 .PHONY: clean
244 clean: cleantests
245         rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
246                 rounding rounding.h *.old rsync*.1 rsync*.5 rsync*.html
247
248 .PHONY: cleantests
249 cleantests:
250         rm -rf ./testtmp*
251
252 # We try to delete built files from both the source and build
253 # directories, just in case somebody previously configured things in
254 # the source directory.
255 .PHONY: distclean
256 distclean: clean
257         rm -f Makefile config.h config.status
258         rm -f stunnel-rsyncd.conf
259         rm -f lib/dummy popt/dummy zlib/dummy
260         rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
261         rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
262         rm -f config.cache config.log
263         rm -f $(srcdir)/config.cache $(srcdir)/config.log
264         rm -f shconfig $(srcdir)/shconfig
265         rm -f $(GENFILES)
266         rm -rf autom4te.cache
267
268 # this target is really just for my use. It only works on a limited
269 # range of machines and is used to produce a list of potentially
270 # dead (ie. unused) functions in the code. (tridge)
271 .PHONY: finddead
272 finddead:
273         nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
274         nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
275         comm -13 nmused.txt nmfns.txt
276
277 # 'check' is the GNU name, 'test' is the name for everybody else :-)
278 .PHONY: test
279 test: check
280
281 # There seems to be no standard way to specify some variables as
282 # exported from a Makefile apart from listing them like this.
283
284 # This depends on building rsync; if we need any helper programs it
285 # should depend on them too.
286
287 # We try to run the scripts with POSIX mode on, in the hope that will
288 # catch Bash-isms earlier even if we're running on GNU.  Of course, we
289 # might lose in the future where POSIX diverges from old sh.
290
291 .PHONY: check
292 check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
293         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
294
295 .PHONY: check29
296 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
297         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
298
299 .PHONY: check30
300 check30: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
301         rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=30
302
303 wildtest.o: wildtest.c t_stub.o lib/wildmatch.c rsync.h config.h
304 wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
305         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
306
307 testsuite/chown-fake.test:
308         ln -s chown.test $(srcdir)/testsuite/chown-fake.test
309
310 testsuite/devices-fake.test:
311         ln -s devices.test $(srcdir)/testsuite/devices-fake.test
312
313 testsuite/xattrs-hlink.test:
314         ln -s xattrs.test $(srcdir)/testsuite/xattrs-hlink.test
315
316 # This does *not* depend on building or installing: you can use it to
317 # check a version installed from a binary or some other source tree,
318 # if you want.
319
320 .PHONY: installcheck
321 installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
322         POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
323
324 # TODO: Add 'dist' target; need to know which files will be included
325
326 # Run the SPLINT (Secure Programming Lint) tool.  <www.splint.org>
327 .PHONY: splint
328 splint:
329         splint +unixlib +gnuextensions -weak rsync.c
330
331 .PHONY: doxygen
332 doxygen:
333         cd $(srcdir) && rm dox/html/* && doxygen
334
335 # for maintainers only
336 .PHONY: doxygen-upload
337 doxygen-upload:
338         rsync -avzv $(srcdir)/dox/html/ --delete \
339         $${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/