1 To build rsync with mgear:
2 1. Apply this patch to the rsync source tree.
3 2. Copy or symlink mgear.mk into the rsync source tree.
6 diff --git a/.cvsignore b/.cvsignore
7 index aa946de..dd2de12 100644
15 diff --git a/Makefile.in b/Makefile.in
16 index 499de47..8a75160 100644
20 +# This is Makefile.in from rsync modified by Matt for use with mgear.
21 +# (Of course, config.status copies the above message to Makefile.)
23 +# It works for compiling the C files, and I demonstrated that warnings no longer
24 +# disappear from Eclipse, which is pretty cool. However, not everything is
25 +# converted to use mgear yet.
28 # Makefile for rsync. This is processed by configure to produce the final
31 @@ -23,8 +31,8 @@ SHELL=/bin/sh
40 HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h lib/pool_alloc.h
41 LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
42 @@ -53,10 +61,14 @@ CHECK_SYMLINKS = testsuite/chown-fake.test testsuite/devices-fake.test
43 CHECK_OBJS=getgroups.o getfsdev.o t_stub.o t_unsafe.o trimslash.o wildtest.o
45 # note that the -I. is needed to handle config.h when using VPATH
48 - $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
50 +## Matt removed @OBJ_SAVE@ and @OBJ_RESTORE@ because they got in the way.
51 +cmd-cc=$(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
52 +$(call mg-define-rule,%.o,%.c,cmd-cc)
54 +## Turn off the built-in implicit rule because it sometimes beats the mgear rule
55 +## because the mgear rule depends on a genfile that might not exist yet.
56 +## TODO: Find a better way to handle this.
61 @@ -71,37 +83,35 @@ install: all
63 $(MAKE) INSTALL_STRIP='-s' install
65 -rsync$(EXEEXT): $(OBJS)
66 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
67 +cmd-exe=$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
69 +$(call mg-define-rule,rsync$(EXEEXT),$(OBJS),cmd-exe)
75 -rounding.h: mkrounding$(EXEEXT)
76 - ./mkrounding$(EXEEXT) >rounding.h
77 +cmd-rounding.h=./mkrounding$(EXEEXT) >$@
78 +$(call mg-define-rule,rounding.h,mkrounding$(EXEEXT),cmd-rounding.h)
80 -mkrounding$(EXEEXT): mkrounding.c rsync.h
81 - @sed '1,/^struct file_struct/d; /^}/,$$d' <$(srcdir)/rsync.h >mkrounding.h
82 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ -I. $(srcdir)/mkrounding.c
84 +define cmd-mkrounding-exe
85 +sed '1,/^struct file_struct/d; /^}/,$$d' <$(srcdir)/rsync.h >mkrounding.h &&\
86 +$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -I. $(srcdir)/mkrounding.c &&\
89 +$(call mg-define-rule,mkrounding$(EXEEXT),mkrounding.c rsync.h,cmd-mkrounding-exe)
91 -tls$(EXEEXT): $(TLS_OBJ)
92 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
93 +$(call mg-define-rule,tls$(EXEEXT),$(TLS_OBJ),cmd-exe)
95 -getgroups$(EXEEXT): getgroups.o
96 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS)
97 +$(call mg-define-rule,getgroups$(EXEEXT),getgroups.o,cmd-exe)
99 -getfsdev$(EXEEXT): getfsdev.o
100 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS)
101 +$(call mg-define-rule,getfsdev$(EXEEXT),getfsdev.o,cmd-exe)
103 TRIMSLASH_OBJ = trimslash.o syscall.o lib/compat.o lib/snprintf.o
104 -trimslash$(EXEEXT): $(TRIMSLASH_OBJ)
105 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TRIMSLASH_OBJ) $(LIBS)
106 +$(call mg-define-rule,trimslash$(EXEEXT),$(TRIMSLASH_OBJ),cmd-exe)
108 T_UNSAFE_OBJ = t_unsafe.o syscall.o util.o t_stub.o lib/compat.o lib/snprintf.o
109 -t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
110 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(T_UNSAFE_OBJ) $(LIBS)
111 +$(call mg-define-rule,t_unsafe$(EXEEXT),$(T_UNSAFE_OBJ),cmd-exe)
114 cd $(srcdir) && $(MAKE) -f prepare-source.mak gen
115 @@ -112,9 +122,11 @@ man:
117 cd $(srcdir) && $(MAKE) -f prepare-source.mak proto.h
119 +## Let mgear do the cleaning.
121 - rm -f *~ $(OBJS) $(TLS_OBJ) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
122 - mkrounding mkrounding.h rounding.h
123 +# rm -f *~ $(OBJS) $(TLS_OBJ) $(CHECK_PROGS) $(CHECK_OBJS) $(CHECK_SYMLINKS) \
124 +# mkrounding mkrounding.h rounding.h
125 + $(call mg-clean-cmd,.)
129 @@ -160,9 +172,11 @@ check: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
130 check29: all $(CHECK_PROGS) $(CHECK_SYMLINKS)
131 rsync_bin=`pwd`/rsync$(EXEEXT) $(srcdir)/runtests.sh --protocol=29
134 wildtest.o: wildtest.c lib/wildmatch.c rsync.h
135 -wildtest$(EXEEXT): wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@
136 - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@ $(LIBS)
137 +$(call mg-define-rule,wildtest$(EXEEXT),wildtest.o lib/compat.o lib/snprintf.o @BUILD_POPT@,cmd-exe)
139 +### Matt stopped here.
141 testsuite/chown-fake.test:
142 ln -s chown.test $(srcdir)/testsuite/chown-fake.test
143 diff --git a/doc/.cvsignore b/doc/.cvsignore
144 index 82b2f29..40fcb95 100644
151 diff --git a/lib/.cvsignore b/lib/.cvsignore
152 index 421376d..5f68c87 100644
158 diff --git a/popt/.cvsignore b/popt/.cvsignore
159 index 337b0d0..391f286 100644
160 --- a/popt/.cvsignore
161 +++ b/popt/.cvsignore
167 diff --git a/zlib/.cvsignore b/zlib/.cvsignore
168 index 421376d..5f68c87 100644
169 --- a/zlib/.cvsignore
170 +++ b/zlib/.cvsignore