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