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