Output numbers in 3-digit groups by default (e.g. 1,234,567).
[rsync/rsync.git] / Makefile.in
CommitLineData
c627d613
AT
1# Makefile for rsync. This is processed by configure to produce the final
2# Makefile
3
6dd1782c 4prefix=@prefix@
9c3c30e5 5datarootdir=@datarootdir@
6dd1782c 6exec_prefix=@exec_prefix@
4040be4d
DD
7bindir=@bindir@
8mandir=@mandir@
c627d613 9
c627d613 10LIBS=@LIBS@
95a38e86 11CC=@CC@
ce2ac5ac 12CFLAGS=@CFLAGS@
a1cc591b
WD
13CPPFLAGS=@CPPFLAGS@
14EXEEXT=@EXEEXT@
6a48ca56 15LDFLAGS=@LDFLAGS@
95a38e86 16
c627d613 17INSTALLCMD=@INSTALL@
daa3d0e2 18INSTALLMAN=@INSTALL@
c627d613 19
d0390cd3 20srcdir=@srcdir@
4040be4d 21VPATH=$(srcdir)
c627d613
AT
22SHELL=/bin/sh
23
a358449a
MP
24VERSION=@VERSION@
25
c627d613
AT
26.SUFFIXES:
27.SUFFIXES: .c .o
28
613c2d44 29GENFILES=configure.sh config.h.in proto.h proto.h-tstamp rsync.1 rsyncd.conf.5
f0799273 30HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h lib/pool_alloc.h
a0456b9c 31LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
16edf865 32 lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@
81f5b275
WD
33ZLIBOBJ=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
34 zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
403dbc13
WD
35OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
36 util.o main.o checksum.o match.o syscall.o log.o backup.o
354c9da6 37OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
16edf865 38 fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
b35d0d8e 39OBJS3=progress.o pipe.o
bcb7e502 40DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
1ac15cd8
MP
41popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
42 popt/popthelp.o popt/poptparse.o
5abe03d6 43OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
c627d613 44
34273554 45TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
7df0935a
MP
46
47# Programs we must have to run the test cases
7d9d5d94 48CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
d7bf70f1 49 trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
7df0935a 50
0b68d6b6
WD
51CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test
52
0c0a3e2d 53# Objects for CHECK_PROGS to clean
fcb1068f 54CHECK_OBJS=tls.o getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
0c0a3e2d 55
366bd905 56# note that the -I. is needed to handle config.h when using VPATH
c627d613 57.c.o:
692da0b5 58@OBJ_SAVE@
a1cc591b 59 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
692da0b5 60@OBJ_RESTORE@
c627d613 61
dd6f31f7 62all: conf_stop make_stop rsync$(EXEEXT) @MAKE_MAN@
a87b3b2a 63
c627d613 64install: all
6aaf8d8c 65 -mkdir -p ${DESTDIR}${bindir}
af45f9e2 66 ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
6aaf8d8c
MP
67 -mkdir -p ${DESTDIR}${mandir}/man1
68 -mkdir -p ${DESTDIR}${mandir}/man5
7ee7bcd4
WD
69 if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi
70 if test -f rsyncd.conf.5; then ${INSTALLMAN} -m 644 rsyncd.conf.5 ${DESTDIR}${mandir}/man5; fi
4040be4d
DD
71
72install-strip:
af45f9e2 73 $(MAKE) INSTALL_STRIP='-s' install
c627d613 74
ec6e0bf0 75rsync$(EXEEXT): $(OBJS)
a1cc591b 76 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
4ff3d9d6 77
fcb1068f
WD
78$(OBJS): $(HEADERS)
79$(CHECK_OBJS): $(HEADERS)
80
403dbc13
WD
81flist.o: rounding.h
82
a5fd4b6e 83rounding.h: rounding.c rsync.h
eca151d4 84 @for r in 0 1 3; do \
ddff23a7 85 if $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o rounding -DEXTRA_ROUNDING=$$r -I. $(srcdir)/rounding.c >rounding.out 2>&1; then \
eca151d4
WD
86 echo "#define EXTRA_ROUNDING $$r" >rounding.h; \
87 if test -f "$$HOME/build_farm/build_test.fns"; then \
88 echo "EXTRA_ROUNDING is $$r" >&2; \
89 fi; \
90 break; \
91 fi; \
92 done
a5fd4b6e 93 @rm -f rounding
eca151d4 94 @if test -f rounding.h; then : ; else \
ebac0319
WD
95 cat rounding.out 1>&2; \
96 echo "Failed to create rounding.h!" 1>&2; \
f859d3de
WD
97 exit 1; \
98 fi
ebac0319 99 @rm -f rounding.out
403dbc13 100
ec6e0bf0 101tls$(EXEEXT): $(TLS_OBJ)
34273554 102 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
7df0935a 103
ec6e0bf0 104getgroups$(EXEEXT): getgroups.o
435f1ed7 105 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
4acbfa2a 106
ef572356
WD
107getfsdev$(EXEEXT): getfsdev.o
108 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
7d9d5d94 109
34bde8d5 110TRIMSLASH_OBJ = trimslash.o syscall.o lib/compat.o lib/snprintf.o
ec6e0bf0 111trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
c127e8aa
MP
112 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
113
4d30f176 114T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o t_stub.o lib/compat.o lib/snprintf.o lib/wildmatch.o
ec6e0bf0 115t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
b35d0d8e
MP
116 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
117
225787a4
WD
118gen: conf proto.h man
119
b82ad950
WD
120gensend: gen
121 rsync -aivzc $(GENFILES) samba.org:/home/ftp/pub/rsync/generated-files/
122
225787a4
WD
123conf:
124 cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
ed43d0a7 125
b82ad950
WD
126conf_stop: configure.sh config.h.in
127
128configure.sh config.h.in: configure.in aclocal.m4
806f530b
WD
129 @if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
130 @if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
b82ad950
WD
131 autoconf -o configure.sh
132 autoheader && touch config.h.in
806f530b
WD
133 @if diff configure.sh configure.sh.old >/dev/null 2>&1; then \
134 echo "configure.sh is unchanged."; \
135 rm configure.sh.old; \
136 fi
137 @if diff config.h.in config.h.in.old >/dev/null 2>&1; then \
138 echo "config.h.in is unchanged."; \
139 rm config.h.in.old; \
140 fi
141 @if test -f configure.sh.old -o -f config.h.in.old; then \
142 echo 'Configure files changed -- perhaps run:'; \
143 echo ' make reconfigure'; \
144 exit 1; \
145 fi
6ec47d3d 146
3e2c0024 147reconfigure: configure.sh
14eaa7a5
WD
148 ./config.status --recheck
149 ./config.status
150
dd6f31f7
WD
151make_stop: Makefile
152
153Makefile: Makefile.in config.status
806f530b 154 @if test -f Makefile; then cp -p Makefile Makefile.old; else touch Makefile.old; fi
dd6f31f7 155 @./config.status
806f530b
WD
156 @if diff Makefile Makefile.old >/dev/null 2>&1; then \
157 echo "Makefile is unchanged."; \
158 rm Makefile.old; \
159 else \
160 echo "Makefile updated -- rerun your make command."; \
161 exit 1; \
162 fi
dd6f31f7 163
225787a4
WD
164proto: proto.h-tstamp
165
166proto.h: proto.h-tstamp
60a986f5 167 @if test -f proto.h; then :; else cp -p $(srcdir)/proto.h .; fi
225787a4 168
091b3459 169proto.h-tstamp: $(srcdir)/*.c $(srcdir)/lib/compat.c
37adeae7 170 perl $(srcdir)/mkproto.pl $(srcdir)/*.c $(srcdir)/lib/compat.c
225787a4
WD
171
172man: rsync.1 rsyncd.conf.5
7ee7bcd4
WD
173 @if test -f rsync.1; then :; else cp -p $(srcdir)/rsync.1 .; fi
174 @if test -f rsyncd.conf.5; then :; else cp -p $(srcdir)/rsyncd.conf.5 .; fi
225787a4
WD
175
176rsync.1: rsync.yo
37adeae7
WD
177 yodl2man -o rsync.1 $(srcdir)/rsync.yo
178 -$(srcdir)/tweak_manpage rsync.1
41059f75 179
225787a4 180rsyncd.conf.5: rsyncd.conf.yo
37adeae7
WD
181 yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
182 -$(srcdir)/tweak_manpage rsyncd.conf.5
c627d613 183
b4768a13 184clean: cleantests
fcb1068f 185 rm -f *~ $(OBJS) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
806f530b 186 rounding rounding.h *.old
9299c8f0
MP
187
188cleantests:
189 rm -rf ./testtmp*
c627d613 190
4610ac79
MP
191# We try to delete built files from both the source and build
192# directories, just in case somebody previously configured things in
193# the source directory.
af21c12f 194distclean: clean
ef6122c6 195 rm -f Makefile config.h config.status
8444a7c0 196 rm -f lib/dummy popt/dummy zlib/dummy
ef6122c6 197 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
8444a7c0 198 rm -f $(srcdir)/lib/dummy $(srcdir)/popt/dummy $(srcdir)/zlib/dummy
2a5904a5
MP
199 rm -f config.cache config.log
200 rm -f $(srcdir)/config.cache $(srcdir)/config.log
2a5904a5 201 rm -f shconfig $(srcdir)/shconfig
7f3b5293 202 rm -f $(GENFILES)
8444a7c0 203 rm -rf autom4te.cache
6e4fb64e
AT
204
205# this target is really just for my use. It only works on a limited
206# range of machines and is used to produce a list of potentially
207# dead (ie. unused) functions in the code. (tridge)
208finddead:
209 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
210 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
ef6122c6 211 comm -13 nmused.txt nmfns.txt
a4772a4d
MP
212
213# 'check' is the GNU name, 'test' is the name for everybody else :-)
214.PHONY: check test
215
216test: check
217
e7d29902
MP
218# There seems to be no standard way to specify some variables as
219# exported from a Makefile apart from listing them like this.
220
3a4c683f
MP
221# This depends on building rsync; if we need any helper programs it
222# should depend on them too.
223
42be5918
MP
224# We try to run the scripts with POSIX mode on, in the hope that will
225# catch Bash-isms earlier even if we're running on GNU. Of course, we
226# might lose in the future where POSIX diverges from old sh.
227
0b68d6b6 228check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
3e88414e 229 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
e7d29902 230
0b68d6b6 231check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
9602b5cf
WD
232 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
233
07ad305e 234wildtest.o: wildtest.c lib/wildmatch.c rsync.h config.h
34273554 235wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
c5e29261 236 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
d7bf70f1 237
0b68d6b6
WD
238testsuite/chown-fake.test:
239 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
240
241testsuite/devices-fake.test:
242 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
243
3a4c683f
MP
244# This does *not* depend on building or installing: you can use it to
245# check a version installed from a binary or some other source tree,
246# if you want.
247
1acb8f51 248installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
ec6e0bf0 249 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
e7d29902 250
cef40af2 251# TODO: Add 'dist' target; need to know which files will be included
6216ca2c 252
5648a819
MP
253# Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
254.PHONY: splint
ef6122c6 255splint:
5648a819
MP
256 splint +unixlib +gnuextensions -weak rsync.c
257
258
6216ca2c
MP
259rsync.dvi: doc/rsync.texinfo
260 texi2dvi -o $@ $<
261
ef6122c6 262rsync.ps: rsync.dvi
6216ca2c
MP
263 dvips -ta4 -o $@ $<
264
265rsync.pdf: doc/rsync.texinfo
266 texi2dvi -o $@ --pdf $<
b35d0d8e
MP
267
268
ef6122c6 269doxygen:
b35d0d8e
MP
270 cd $(srcdir) && rm dox/html/* && doxygen
271
272# for maintainers only
ef6122c6 273doxygen-upload:
b35d0d8e
MP
274 rsync -avzv $(srcdir)/dox/html/ --delete \
275 samba.org:/home/httpd/html/rsync/doxygen/head/