Changed a "for" loop into a "do ... while" loop.
[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
AT
4prefix=@prefix@
5exec_prefix=@exec_prefix@
4040be4d
DD
6bindir=@bindir@
7mandir=@mandir@
c627d613 8
c627d613 9LIBS=@LIBS@
95a38e86 10CC=@CC@
ce2ac5ac 11CFLAGS=@CFLAGS@
a1cc591b
WD
12CPPFLAGS=@CPPFLAGS@
13EXEEXT=@EXEEXT@
6a48ca56 14LDFLAGS=@LDFLAGS@
95a38e86 15
c627d613 16INSTALLCMD=@INSTALL@
daa3d0e2 17INSTALLMAN=@INSTALL@
c627d613 18
d0390cd3 19srcdir=@srcdir@
4040be4d 20VPATH=$(srcdir)
c627d613
AT
21SHELL=/bin/sh
22
a358449a
MP
23VERSION=@VERSION@
24
c627d613
AT
25.SUFFIXES:
26.SUFFIXES: .c .o
27
54fd3e50 28HEADERS=byteorder.h config.h errcode.h proto.h rsync.h lib/pool_alloc.h
3c0b1ebf 29LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
9935066b 30 lib/permstring.o lib/pool_alloc.o @LIBOBJS@
5914bf15
PM
31ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
32 zlib/inflate.o zlib/inftrees.o zlib/infutil.o zlib/trees.o \
ef6122c6
WD
33 zlib/zutil.o zlib/adler32.o
34OBJS1=rsync.o generator.o receiver.o cleanup.o sender.o exclude.o util.o \
35 main.o checksum.o match.o syscall.o log.o backup.o
36OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \
37 fileio.o batch.o clientname.o
b35d0d8e 38OBJS3=progress.o pipe.o
bcb7e502 39DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
1ac15cd8
MP
40popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
41 popt/popthelp.o popt/poptparse.o
b35d0d8e 42OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
c627d613 43
ef6122c6 44TLS_OBJ = tls.o syscall.o lib/permstring.o
7df0935a
MP
45
46# Programs we must have to run the test cases
ec6e0bf0 47CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) \
d7bf70f1 48 trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
7df0935a 49
0c0a3e2d 50# Objects for CHECK_PROGS to clean
d7bf70f1 51CHECK_OBJS=getgroups.o t_stub.o t_unsafe.o trimslash.o wildtest.o
0c0a3e2d 52
366bd905 53# note that the -I. is needed to handle config.h when using VPATH
c627d613 54.c.o:
692da0b5 55@OBJ_SAVE@
a1cc591b 56 $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
692da0b5 57@OBJ_RESTORE@
c627d613 58
ec6e0bf0 59all: rsync$(EXEEXT)
a87b3b2a 60
914f3066
WD
61gen: configure config.h.in proto man
62
a87b3b2a 63man: rsync.1 rsyncd.conf.5
c627d613
AT
64
65install: all
6aaf8d8c 66 -mkdir -p ${DESTDIR}${bindir}
af45f9e2 67 ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
6aaf8d8c
MP
68 -mkdir -p ${DESTDIR}${mandir}/man1
69 -mkdir -p ${DESTDIR}${mandir}/man5
70 ${INSTALLMAN} -m 644 $(srcdir)/rsync.1 ${DESTDIR}${mandir}/man1
71 ${INSTALLMAN} -m 644 $(srcdir)/rsyncd.conf.5 ${DESTDIR}${mandir}/man5
4040be4d
DD
72
73install-strip:
af45f9e2 74 $(MAKE) INSTALL_STRIP='-s' install
c627d613 75
ec6e0bf0 76rsync$(EXEEXT): $(OBJS)
a1cc591b 77 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
4ff3d9d6 78
a1513439 79$(OBJS): $(HEADERS)
a5ce1eb1 80
ec6e0bf0 81tls$(EXEEXT): $(TLS_OBJ)
956ff9ff 82 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
7df0935a 83
ec6e0bf0 84getgroups$(EXEEXT): getgroups.o
435f1ed7 85 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
4acbfa2a 86
c127e8aa 87TRIMSLASH_OBJ = trimslash.o syscall.o
ec6e0bf0 88trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
c127e8aa
MP
89 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
90
9a933bc2 91T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o t_stub.o lib/compat.o lib/snprintf.o
ec6e0bf0 92t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
b35d0d8e
MP
93 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
94
914f3066
WD
95configure: configure.in aclocal.m4
96 autoconf
4ff3d9d6 97
914f3066
WD
98config.h.in: configure.in aclocal.m4
99 autoheader
c627d613 100
48c1586c
MP
101$(srcdir)/rsync.1: $(srcdir)/rsync.yo
102 yodl2man -o $(srcdir)/rsync.1 $(srcdir)/rsync.yo
41059f75 103
48c1586c
MP
104$(srcdir)/rsyncd.conf.5: $(srcdir)/rsyncd.conf.yo
105 yodl2man -o $(srcdir)/rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo
41059f75 106
c627d613 107proto:
914f3066
WD
108 cat $(srcdir)/*.c $(srcdir)/lib/compat.c | awk -f $(srcdir)/mkproto.awk >$(srcdir)/proto.h.new
109 if diff $(srcdir)/proto.h $(srcdir)/proto.h.new >/dev/null; then \
110 rm $(srcdir)/proto.h.new; \
111 else \
112 mv $(srcdir)/proto.h.new $(srcdir)/proto.h; \
113 fi
c627d613 114
9299c8f0 115clean: cleantests
a1cc591b 116 rm -f *~ $(OBJS) $(TLS_OBJ) $(CHECK_PROGS) $(CHECK_OBJS)
9299c8f0
MP
117
118cleantests:
119 rm -rf ./testtmp*
c627d613 120
4610ac79
MP
121# We try to delete built files from both the source and build
122# directories, just in case somebody previously configured things in
123# the source directory.
af21c12f 124distclean: clean
ef6122c6
WD
125 rm -f Makefile config.h config.status
126 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
2a5904a5
MP
127
128 rm -f config.cache config.log
129 rm -f $(srcdir)/config.cache $(srcdir)/config.log
130
131 rm -f shconfig $(srcdir)/shconfig
6e4fb64e
AT
132
133# this target is really just for my use. It only works on a limited
134# range of machines and is used to produce a list of potentially
135# dead (ie. unused) functions in the code. (tridge)
136finddead:
137 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
138 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
ef6122c6 139 comm -13 nmused.txt nmfns.txt
a4772a4d
MP
140
141# 'check' is the GNU name, 'test' is the name for everybody else :-)
142.PHONY: check test
143
144test: check
145
e7d29902
MP
146
147# There seems to be no standard way to specify some variables as
148# exported from a Makefile apart from listing them like this.
149
3a4c683f
MP
150# This depends on building rsync; if we need any helper programs it
151# should depend on them too.
152
42be5918
MP
153# We try to run the scripts with POSIX mode on, in the hope that will
154# catch Bash-isms earlier even if we're running on GNU. Of course, we
155# might lose in the future where POSIX diverges from old sh.
156
7df0935a 157check: all $(CHECK_PROGS)
ec6e0bf0 158 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin=`pwd`/rsync$(EXEEXT) srcdir="$(srcdir)" $(srcdir)/runtests.sh
e7d29902 159
2a1874cc 160wildtest.o: wildtest.c lib/wildmatch.c rsync.h
e37d8229 161wildtest$(EXEEXT): wildtest.o
277d99e8 162 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o @BUILD_POPT@ $(LIBS)
d7bf70f1 163
3a4c683f
MP
164# This does *not* depend on building or installing: you can use it to
165# check a version installed from a binary or some other source tree,
166# if you want.
167
7df0935a 168installcheck: $(CHECK_PROGS)
ec6e0bf0 169 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
e7d29902 170
cef40af2 171# TODO: Add 'dist' target; need to know which files will be included
6216ca2c 172
5648a819
MP
173# Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
174.PHONY: splint
ef6122c6 175splint:
5648a819
MP
176 splint +unixlib +gnuextensions -weak rsync.c
177
178
6216ca2c
MP
179rsync.dvi: doc/rsync.texinfo
180 texi2dvi -o $@ $<
181
ef6122c6 182rsync.ps: rsync.dvi
6216ca2c
MP
183 dvips -ta4 -o $@ $<
184
185rsync.pdf: doc/rsync.texinfo
186 texi2dvi -o $@ --pdf $<
b35d0d8e
MP
187
188
ef6122c6 189doxygen:
b35d0d8e
MP
190 cd $(srcdir) && rm dox/html/* && doxygen
191
192# for maintainers only
ef6122c6 193doxygen-upload:
b35d0d8e
MP
194 rsync -avzv $(srcdir)/dox/html/ --delete \
195 samba.org:/home/httpd/html/rsync/doxygen/head/