Commit | Line | Data |
---|---|---|
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. | |
16 | include mgear.mk | |
17 | ||
18 | # Makefile for rsync. This is processed by configure to produce the final | |
19 | # Makefile | |
20 | ||
21 | prefix=@prefix@ | |
22 | datarootdir=@datarootdir@ | |
23 | exec_prefix=@exec_prefix@ | |
24 | bindir=@bindir@ | |
25 | mandir=@mandir@ | |
26 | ||
27 | LIBS=@LIBS@ | |
28 | CC=@CC@ | |
29 | CFLAGS=@CFLAGS@ | |
30 | CPPFLAGS=@CPPFLAGS@ | |
31 | EXEEXT=@EXEEXT@ | |
32 | LDFLAGS=@LDFLAGS@ | |
33 | ||
34 | INSTALLCMD=@INSTALL@ | |
35 | INSTALLMAN=@INSTALL@ | |
36 | ||
37 | srcdir=@srcdir@ | |
38 | VPATH=$(srcdir) | |
39 | SHELL=/bin/sh | |
40 | ||
41 | VERSION=@VERSION@ | |
42 | ||
43 | #.SUFFIXES: | |
44 | #.SUFFIXES: .c .o | |
45 | ||
46 | HEADERS=byteorder.h config.h errcode.h proto.h rsync.h lib/pool_alloc.h | |
47 | LIBOBJ=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@ | |
49 | ZLIBOBJ=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 | |
51 | OBJS1=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 | |
53 | OBJS2=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 | |
55 | OBJS3=progress.o pipe.o | |
56 | DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o | |
57 | popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \ | |
58 | popt/popthelp.o popt/poptparse.o | |
59 | OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@ | |
60 | ||
61 | TLS_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 | |
64 | CHECK_PROGS = rsync$(EXEEXT) tls$(EXEEXT) getgroups$(EXEEXT) getfsdev$(EXEEXT) \ | |
65 | trimslash$(EXEEXT) t_unsafe$(EXEEXT) wildtest$(EXEEXT) | |
66 | ||
67 | CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test | |
68 | ||
69 | # Objects for CHECK_PROGS to clean | |
70 | CHECK_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. | |
74 | cmd-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 | ||
82 | all: rsync$(EXEEXT) | |
83 | ||
84 | install: 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 | ||
92 | install-strip: | |
93 | $(MAKE) INSTALL_STRIP='-s' install | |
94 | ||
95 | cmd-exe=$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) | |
96 | ||
97 | $(call mg-define-rule,rsync$(EXEEXT),$(OBJS),cmd-exe) | |
98 | ||
99 | $(OBJS): $(HEADERS) | |
100 | ||
101 | flist.o: rounding.h | |
102 | ||
103 | cmd-rounding.h=./mkrounding$(EXEEXT) >$@ | |
104 | $(call mg-define-rule,rounding.h,mkrounding$(EXEEXT),cmd-rounding.h) | |
105 | ||
106 | define cmd-mkrounding-exe | |
107 | sed '1,/^struct file_struct/d; /^}/,$$d' <$(srcdir)/rsync.h >mkrounding.h &&\ | |
108 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -I. $(srcdir)/mkrounding.c &&\ | |
109 | rm mkrounding.h | |
110 | endef | |
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 | ||
119 | TRIMSLASH_OBJ = trimslash.o syscall.o lib/compat.o lib/snprintf.o | |
120 | $(call mg-define-rule,trimslash$(EXEEXT),$(TRIMSLASH_OBJ),cmd-exe) | |
121 | ||
122 | T_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 | ||
125 | gen: | |
126 | cd $(srcdir) && $(MAKE) -f prepare-source.mak gen | |
127 | ||
128 | man: | |
129 | cd $(srcdir) && $(MAKE) -f prepare-source.mak man | |
130 | ||
131 | proto: | |
132 | cd $(srcdir) && $(MAKE) -f prepare-source.mak proto.h | |
133 | ||
134 | ## Let mgear do the cleaning. | |
135 | clean: 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 | ||
140 | cleantests: | |
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. | |
146 | distclean: 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) | |
158 | finddead: | |
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 | ||
166 | test: 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 | ||
178 | check: all $(CHECK_PROGS) $(CHECK_SYMLINKS) | |
179 | rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh | |
180 | ||
181 | check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS) | |
182 | rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29 | |
183 | ||
184 | ||
185 | wildtest.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 | ||
190 | testsuite/chown-fake.test: | |
191 | ln -s chown.test $(srcdir)/testsuite/chown-fake.test | |
192 | ||
193 | testsuite/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 | ||
200 | installcheck: $(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 | |
207 | splint: | |
208 | splint +unixlib +gnuextensions -weak rsync.c | |
209 | ||
210 | ||
211 | rsync.dvi: doc/rsync.texinfo | |
212 | texi2dvi -o $@ $< | |
213 | ||
214 | rsync.ps: rsync.dvi | |
215 | dvips -ta4 -o $@ $< | |
216 | ||
217 | rsync.pdf: doc/rsync.texinfo | |
218 | texi2dvi -o $@ --pdf $< | |
219 | ||
220 | ||
221 | doxygen: | |
222 | cd $(srcdir) && rm dox/html/* && doxygen | |
223 | ||
224 | # for maintainers only | |
225 | doxygen-upload: | |
226 | rsync -avzv $(srcdir)/dox/html/ --delete \ | |
227 | samba.org:/home/httpd/html/rsync/doxygen/head/ |