- Add Makefile.in for building rsync with mgear. Yay!
[mgear/mgear.git] / experiments / rsync-Makefile.in
CommitLineData
b811570b
MM
1# This is Makefile.in from rsync modified by Matt for use with mgear.
2# (Of course, config.status copies the above message to Makefile.)
3#
4# Follow these steps to build rsync with mgear:
5# 1. Check rsync out from CVS.
6# 2. Replace its Makefile.in with this file. This file is based on revision
7# 1.138; merge as necessary if the CVS is now at a newer revision.
8# 3. Copy mgear.mk into the rsync source tree.
9# 4. If you wish, add the pattern *.g to the cvsignore files so you aren't
10# continually bothered about the genfiles.
11# 5. ./configure, make as usual.
12#
13# It works for compiling the C files, and I demonstrated that warnings no longer
14# disappear from Eclipse, which is pretty cool. However, not everything is
15# converted to use mgear yet.
16include mgear.mk
17
18# Makefile for rsync. This is processed by configure to produce the final
19# Makefile
20
21prefix=@prefix@
22datarootdir=@datarootdir@
23exec_prefix=@exec_prefix@
24bindir=@bindir@
25mandir=@mandir@
26
27LIBS=@LIBS@
28CC=@CC@
29CFLAGS=@CFLAGS@
30CPPFLAGS=@CPPFLAGS@
31EXEEXT=@EXEEXT@
32LDFLAGS=@LDFLAGS@
33
34INSTALLCMD=@INSTALL@
35INSTALLMAN=@INSTALL@
36
37srcdir=@srcdir@
38VPATH=$(srcdir)
39SHELL=/bin/sh
40
41VERSION=@VERSION@
42
43#.SUFFIXES:
44#.SUFFIXES: .c .o
45
46HEADERS=byteorder.h config.h errcode.h proto.h rsync.h lib/pool_alloc.h
47LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
48 lib/permstring.o lib/pool_alloc.o lib/sysacls.o lib/sysxattrs.o @LIBOBJS@
49ZLIBOBJ=zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o \
50 zlib/trees.o zlib/zutil.o zlib/adler32.o zlib/compress.o zlib/crc32.o
51OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
52 util.o main.o checksum.o match.o syscall.o log.o backup.o
53OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o \
54 fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
55OBJS3=progress.o pipe.o
56DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
57popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
58 popt/popthelp.o popt/poptparse.o
59OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
60
61TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
62
63# Programs we must have to run the test cases
64CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \
65 trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT)
66
67CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test
68
69# Objects for CHECK_PROGS to clean
70CHECK_OBJS=getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
71
72# note that the -I. is needed to handle config.h when using VPATH
73## Matt removed @OBJ_SAVE@ and @OBJ_RESTORE@ because they got in the way.
74cmd-cc=$(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
75$(call mg-define-rule,%.o,%.c,cmd-cc)
76
77## Turn off the built-in implicit rule because it sometimes beats the mgear rule
78## because the mgear rule depends on a genfile that might not exist yet.
79## TODO: Find a better way to handle this.
80%.o: %.c
81
82all: rsync$(EXEEXT)
83
84install: all
85 -mkdir -p ${DESTDIR}${bindir}
86 ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir}
87 -mkdir -p ${DESTDIR}${mandir}/man1
88 -mkdir -p ${DESTDIR}${mandir}/man5
89 ${INSTALLMAN} -m 644 $(srcdir)/rsync.1 ${DESTDIR}${mandir}/man1
90 ${INSTALLMAN} -m 644 $(srcdir)/rsyncd.conf.5 ${DESTDIR}${mandir}/man5
91
92install-strip:
93 $(MAKE) INSTALL_STRIP='-s' install
94
95cmd-exe=$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
96
97$(call mg-define-rule,rsync$(EXEEXT),$(OBJS),cmd-exe)
98
99$(OBJS): $(HEADERS)
100
101flist.o: rounding.h
102
103cmd-rounding.h=./mkrounding$(EXEEXT) >$@
104$(call mg-define-rule,rounding.h,mkrounding$(EXEEXT),cmd-rounding.h)
105
106define cmd-mkrounding-exe
107sed '1,/^struct file_struct/d; /^}/,$$d' <$(srcdir)/rsync.h >mkrounding.h &&\
108$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -I. $(srcdir)/mkrounding.c &&\
109rm mkrounding.h
110endef
111$(call mg-define-rule,mkrounding$(EXEEXT),mkrounding.c rsync.h,cmd-mkrounding-exe)
112
113$(call mg-define-rule,tls$(EXEEXT),$(TLS_OBJ),cmd-exe)
114
115$(call mg-define-rule,getgroups$(EXEEXT),getgroups.o,cmd-exe)
116
117$(call mg-define-rule,getfsdev$(EXEEXT),getfsdev.o,cmd-exe)
118
119TRIMSLASH_OBJ = trimslash.o syscall.o lib/compat.o lib/snprintf.o
120$(call mg-define-rule,trimslash$(EXEEXT),$(TRIMSLASH_OBJ),cmd-exe)
121
122T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o t_stub.o lib/compat.o lib/snprintf.o
123$(call mg-define-rule,t_unsafe$(EXEEXT),$(T_UNSAFE_OBJ),cmd-exe)
124
125gen:
126 cd $(srcdir) && $(MAKE) -f prepare-source.mak gen
127
128man:
129 cd $(srcdir) && $(MAKE) -f prepare-source.mak man
130
131proto:
132 cd $(srcdir) && $(MAKE) -f prepare-source.mak proto.h
133
134## Let mgear do the cleaning.
135clean: cleantests
136# rm -f *~ $(OBJS) $(TLS_OBJ) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
137# mkrounding mkrounding.h rounding.h
138 $(call mg-clean-cmd,.)
139
140cleantests:
141 rm -rf ./testtmp*
142
143# We try to delete built files from both the source and build
144# directories, just in case somebody previously configured things in
145# the source directory.
146distclean: clean
147 rm -f Makefile config.h config.status
148 rm -f $(srcdir)/Makefile $(srcdir)/config.h $(srcdir)/config.status
149
150 rm -f config.cache config.log
151 rm -f $(srcdir)/config.cache $(srcdir)/config.log
152
153 rm -f shconfig $(srcdir)/shconfig
154
155# this target is really just for my use. It only works on a limited
156# range of machines and is used to produce a list of potentially
157# dead (ie. unused) functions in the code. (tridge)
158finddead:
159 nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt
160 nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt
161 comm -13 nmused.txt nmfns.txt
162
163# 'check' is the GNU name, 'test' is the name for everybody else :-)
164.PHONY: check test
165
166test: check
167
168# There seems to be no standard way to specify some variables as
169# exported from a Makefile apart from listing them like this.
170
171# This depends on building rsync; if we need any helper programs it
172# should depend on them too.
173
174# We try to run the scripts with POSIX mode on, in the hope that will
175# catch Bash-isms earlier even if we're running on GNU. Of course, we
176# might lose in the future where POSIX diverges from old sh.
177
178check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
179 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh
180
181check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
182 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
183
184
185wildtest.o: wildtest.c lib/wildmatch.c rsync.h
186$(call mg-define-rule,wildtest$(EXEEXT),wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@,cmd-exe)
187
188### Matt stopped here.
189
190testsuite/chown-fake.test:
191 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
192
193testsuite/devices-fake.test:
194 ln -s devices.test $(srcdir)/testsuite/devices-fake.test
195
196# This does *not* depend on building or installing: you can use it to
197# check a version installed from a binary or some other source tree,
198# if you want.
199
200installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
201 POSIXLY_CORRECT=1 TOOLDIR=`pwd` rsync_bin="$(bindir)/rsync$(EXEEXT)" srcdir="$(srcdir)" $(srcdir)/runtests.sh
202
203# TODO: Add 'dist' target; need to know which files will be included
204
205# Run the SPLINT (Secure Programming Lint) tool. <www.splint.org>
206.PHONY: splint
207splint:
208 splint +unixlib +gnuextensions -weak rsync.c
209
210
211rsync.dvi: doc/rsync.texinfo
212 texi2dvi -o $@ $<
213
214rsync.ps: rsync.dvi
215 dvips -ta4 -o $@ $<
216
217rsync.pdf: doc/rsync.texinfo
218 texi2dvi -o $@ --pdf $<
219
220
221doxygen:
222 cd $(srcdir) && rm dox/html/* && doxygen
223
224# for maintainers only
225doxygen-upload:
226 rsync -avzv $(srcdir)/dox/html/ --delete \
227 samba.org:/home/httpd/html/rsync/doxygen/head/