| 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. |
| 4 | 3. "make" as usual. |
| 5 | |
| 6 | diff --git a/.cvsignore b/.cvsignore |
| 7 | index aa946de..dd2de12 100644 |
| 8 | --- a/.cvsignore |
| 9 | +++ b/.cvsignore |
| 10 | @@ -1,3 +1,4 @@ |
| 11 | +*.g |
| 12 | ID |
| 13 | Makefile |
| 14 | autom4te*.cache |
| 15 | diff --git a/Makefile.in b/Makefile.in |
| 16 | index 499de47..8a75160 100644 |
| 17 | --- a/Makefile.in |
| 18 | +++ b/Makefile.in |
| 19 | @@ -1,3 +1,11 @@ |
| 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.) |
| 22 | +# |
| 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. |
| 26 | +include mgear.mk |
| 27 | + |
| 28 | # Makefile for rsync. This is processed by configure to produce the final |
| 29 | # Makefile |
| 30 | |
| 31 | @@ -23,8 +31,8 @@ SHELL=/bin/sh |
| 32 | |
| 33 | VERSION=@VERSION@ |
| 34 | |
| 35 | -.SUFFIXES: |
| 36 | -.SUFFIXES: .c .o |
| 37 | +#.SUFFIXES: |
| 38 | +#.SUFFIXES: .c .o |
| 39 | |
| 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 |
| 44 | |
| 45 | # note that the -I. is needed to handle config.h when using VPATH |
| 46 | -.c.o: |
| 47 | -@OBJ_SAVE@ |
| 48 | - $(CC) -I. -I$(srcdir) $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@ |
| 49 | -@OBJ_RESTORE@ |
| 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) |
| 53 | + |
| 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. |
| 57 | +%.o: %.c |
| 58 | |
| 59 | all: rsync$(EXEEXT) |
| 60 | |
| 61 | @@ -71,37 +83,35 @@ install: all |
| 62 | install-strip: |
| 63 | $(MAKE) INSTALL_STRIP='-s' install |
| 64 | |
| 65 | -rsync$(EXEEXT): $(OBJS) |
| 66 | - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) |
| 67 | +cmd-exe=$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) |
| 68 | + |
| 69 | +$(call mg-define-rule,rsync$(EXEEXT),$(OBJS),cmd-exe) |
| 70 | |
| 71 | $(OBJS): $(HEADERS) |
| 72 | |
| 73 | flist.o: rounding.h |
| 74 | |
| 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) |
| 79 | |
| 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 |
| 83 | - @rm mkrounding.h |
| 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 &&\ |
| 87 | +rm mkrounding.h |
| 88 | +endef |
| 89 | +$(call mg-define-rule,mkrounding$(EXEEXT),mkrounding.c rsync.h,cmd-mkrounding-exe) |
| 90 | |
| 91 | -tls$(EXEEXT): $(TLS_OBJ) |
| 92 | - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS) |
| 93 | +$(call mg-define-rule,tls$(EXEEXT),$(TLS_OBJ),cmd-exe) |
| 94 | |
| 95 | -getgroups$(EXEEXT): getgroups.o |
| 96 | - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getgroups.o $(LIBS) |
| 97 | +$(call mg-define-rule,getgroups$(EXEEXT),getgroups.o,cmd-exe) |
| 98 | |
| 99 | -getfsdev$(EXEEXT): getfsdev.o |
| 100 | - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ getfsdev.o $(LIBS) |
| 101 | +$(call mg-define-rule,getfsdev$(EXEEXT),getfsdev.o,cmd-exe) |
| 102 | |
| 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) |
| 107 | |
| 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) |
| 112 | |
| 113 | gen: |
| 114 | cd $(srcdir) && $(MAKE) -f prepare-source.mak gen |
| 115 | @@ -112,9 +122,11 @@ man: |
| 116 | proto: |
| 117 | cd $(srcdir) && $(MAKE) -f prepare-source.mak proto.h |
| 118 | |
| 119 | +## Let mgear do the cleaning. |
| 120 | clean: cleantests |
| 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,.) |
| 126 | |
| 127 | cleantests: |
| 128 | rm -rf ./testtmp* |
| 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 |
| 132 | |
| 133 | + |
| 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) |
| 138 | + |
| 139 | +### Matt stopped here. |
| 140 | |
| 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 |
| 145 | --- a/doc/.cvsignore |
| 146 | +++ b/doc/.cvsignore |
| 147 | @@ -1,2 +1,3 @@ |
| 148 | +*.g |
| 149 | rsync.pdf |
| 150 | rsync.ps |
| 151 | diff --git a/lib/.cvsignore b/lib/.cvsignore |
| 152 | index 421376d..5f68c87 100644 |
| 153 | --- a/lib/.cvsignore |
| 154 | +++ b/lib/.cvsignore |
| 155 | @@ -1 +1,2 @@ |
| 156 | +*.g |
| 157 | dummy |
| 158 | diff --git a/popt/.cvsignore b/popt/.cvsignore |
| 159 | index 337b0d0..391f286 100644 |
| 160 | --- a/popt/.cvsignore |
| 161 | +++ b/popt/.cvsignore |
| 162 | @@ -1,3 +1,4 @@ |
| 163 | +*.g |
| 164 | ID |
| 165 | Makefile |
| 166 | config.cache |
| 167 | diff --git a/zlib/.cvsignore b/zlib/.cvsignore |
| 168 | index 421376d..5f68c87 100644 |
| 169 | --- a/zlib/.cvsignore |
| 170 | +++ b/zlib/.cvsignore |
| 171 | @@ -1 +1,2 @@ |
| 172 | +*.g |
| 173 | dummy |