[Libguestfs] [PATCH] build: Add common rule for sources shared between daemon and library

Matthew Booth mbooth at redhat.com
Tue Jan 29 16:16:57 UTC 2013


---
 daemon/Makefile.am | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index b7731ac..e1e2a10 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -39,6 +39,17 @@ EXTRA_DIST = \
 	$(BUILT_SOURCES) \
 	guestfsd.pod
 
+SHARED_WITH_LIBRARY = \
+  guestfs_protocol.c \
+  guestfs_protocol.h \
+  errnostring-gperf.gperf \
+  errnostring.c \
+  errnostring.h
+
+$(SHARED_WITH_LIBRARY): %: $(libsrcdir)/%
+	rm -f $@
+	ln $< $@
+
 noinst_LIBRARIES = libprotocol.a
 
 # This convenience library is solely to compile its generated sources with
@@ -46,12 +57,6 @@ noinst_LIBRARIES = libprotocol.a
 libprotocol_a_SOURCES = guestfs_protocol.c guestfs_protocol.h
 libprotocol_a_CFLAGS = -Wall -Wno-unused -fno-strict-aliasing
 
-guestfs_protocol.c: $(libsrcdir)/guestfs_protocol.c
-	rm -f $@
-	ln $< $@
-guestfs_protocol.h: $(libsrcdir)/guestfs_protocol.h
-	rm -f $@
-	ln $< $@
 $(libsrcdir)/guestfs_protocol.c: force
 	$(MAKE) -C $(libsrcdir) guestfs_protocol.c
 $(libsrcdir)/guestfs_protocol.h: force
@@ -70,15 +75,6 @@ errnostring-gperf.c: errnostring-gperf.gperf
 	rm -f $@
 	$(GPERF) -t $< > $@-t
 	mv $@-t $@
-errnostring-gperf.gperf: $(libsrcdir)/errnostring-gperf.gperf
-	rm -f $@
-	ln $< $@
-errnostring.c: $(libsrcdir)/errnostring.c
-	rm -f $@
-	ln $< $@
-errnostring.h: $(libsrcdir)/errnostring.h
-	rm -f $@
-	ln $< $@
 
 if INSTALL_DAEMON
 sbin_PROGRAMS = guestfsd
-- 
1.8.1




More information about the Libguestfs mailing list