1 # Makefile for rsync. This is processed by configure to produce the final
5 exec_prefix=@exec_prefix@
26 LIBOBJ=lib/fnmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
29 ZLIBOBJ=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 \
31 zlib/zutil.o zlib/adler32.o
32 OBJS1=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
33 OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o fileio.o batch.o \
35 DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
36 popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
37 popt/popthelp.o popt/poptparse.o
38 OBJS=$(OBJS1) $(OBJS2) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
40 TLS_OBJ = tls.o syscall.o lib/permstring.o
42 # Programs we must have to run the test cases
43 CHECK_PROGS = rsync tls getgroups trimslash
45 # note that the -I. is needed to handle config.h when using VPATH
48 $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< @CC_SHOBJ_FLAG@
53 man: rsync.1 rsyncd.conf.5
56 -mkdir -p ${DESTDIR}${bindir}
57 ${INSTALLCMD} ${STRIP} -m 755 rsync ${DESTDIR}${bindir}
58 -mkdir -p ${DESTDIR}${mandir}/man1
59 -mkdir -p ${DESTDIR}${mandir}/man5
60 ${INSTALLMAN} -m 644 $(srcdir)/rsync.1 ${DESTDIR}${mandir}/man1
61 ${INSTALLMAN} -m 644 $(srcdir)/rsyncd.conf.5 ${DESTDIR}${mandir}/man5
64 $(MAKE) STRIP='-s' install
67 @echo "Please ignore warnings below about mktemp -- it is used in a safe way"
68 $(CC) $(CFLAGS) $(LDFLAGS) -o rsync $(OBJS) $(LIBS)
73 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
75 getgroups: getgroups.o
76 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
78 TRIMSLASH_OBJ = trimslash.o syscall.o
79 trimslash: $(TRIMSLASH_OBJ)
80 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
82 # I don't like these rules because CVS can skew the timestamps and
83 # produce spurious warnings, and also make "make install" fail if the
84 # source directory can no longer be found. Since we don't rebuild
85 # automatically they're kind of lame anyhow.
87 #Makefile: Makefile.in configure config.status
88 # echo "WARNING: You need to run ./config.status --recheck"
90 # don't actually run autoconf, just issue a warning
91 #configure: configure.in
92 # echo "WARNING: you need to rerun autoconf"
95 yodl2man -o rsync.1 rsync.yo
97 rsyncd.conf.5: rsyncd.conf.yo
98 yodl2man -o rsyncd.conf.5 rsyncd.conf.yo
101 cat $(srcdir)/*.c $(srcdir)/lib/compat.c | awk -f $(srcdir)/mkproto.awk > $(srcdir)/proto.h
104 rm -f *~ $(OBJS) rsync $(TLS_OBJ) $(CHECK_PROGS)
109 # We try to delete built files from both the source and build
110 # directories, just in case somebody previously configured things in
111 # the source directory.
113 rm -f Makefile config.h config.status
114 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
116 rm -f config.cache config.log
117 rm -f $(srcdir)/config.cache $(srcdir)/config.log
119 rm -f shconfig $(srcdir)/shconfig
121 # this target is really just for my use. It only works on a limited
122 # range of machines and is used to produce a list of potentially
123 # dead (ie. unused) functions in the code. (tridge)
125 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
126 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
127 comm -13 nmused.txt nmfns.txt
129 # 'check' is the GNU name, 'test' is the name for everybody else :-)
135 # There seems to be no standard way to specify some variables as
136 # exported from a Makefile apart from listing them like this.
138 # TODO: Tests that depend on built test aide programs like tls need to
139 # know where the build directory is.
141 # This depends on building rsync; if we need any helper programs it
142 # should depend on them too.
144 # We try to run the scripts with POSIX mode on, in the hope that will
145 # catch Bash-isms earlier even if we're running on GNU. Of course, we
146 # might lose in the future where POSIX diverges from old sh.
148 check: all $(CHECK_PROGS)
149 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin=`pwd`/rsync srcdir="$(srcdir)" $(srcdir)/runtests.sh
151 # This does *not* depend on building or installing: you can use it to
152 # check a version installed from a binary or some other source tree,
155 installcheck: $(CHECK_PROGS)
156 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync" srcdir="$(srcdir)" $(srcdir)/runtests.sh
158 # TODO: Add 'dist' target; need to know which files will be included
160 # Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
163 splint +unixlib +gnuextensions -weak rsync.c
166 rsync.dvi: doc/rsync.texinfo
172 rsync.pdf: doc/rsync.texinfo
173 texi2dvi -o $@ --pdf $<