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