[CRIU] [PATCH 6/7] test/zdtm: use separate compile/link

Kir Kolyshkin kir at openvz.org
Wed Mar 15 16:17:23 PDT 2017


For compatibility with ccache (so it can cache the compilation results),
let's compile and link separately. For this, we have to
 - disable the implicit make rules
 - write the explicit ones

While at it, do use the "silent make" stuff that is already here

FIXME: figure out if it helps to speed up ccache build

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 test/zdtm/static/Makefile     | 15 +++++++++++----
 test/zdtm/transition/Makefile | 15 +++++++++++----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index d4f8ddf..84c73c4 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -1,4 +1,5 @@
 include ../Makefile.inc
+.SUFFIXES:	# No implicit rules
 
 LIBDIR	= ../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
@@ -317,9 +318,15 @@ OUT	= $(TST:%=%.out)
 STATE	= $(TST_STATE:%=%.state)
 STATE_OUT	= $(TST_STATE:%=%.out)
 
-%: %.c
-	$(Q)echo $@ >> .gitignore
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LOADLIBES) $^ $(LDLIBS) -o $@
+%.o: %.c
+	@echo $@ >> .gitignore
+	$(E) " CC       " $@
+	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+%: %.o
+	@echo $@ >> .gitignore
+	$(E) " LINK     " $@
+	$(Q)$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
 
 all:	$(TST) criu-rtc.so
 install: all
@@ -394,7 +401,7 @@ wait_stop:
 		i=`expr $$i + 1`; \
 	done
 
-$(TST):	$(LIB)
+$(TST):	| $(LIB)
 
 aio00:			override LDLIBS += -laio
 different_creds:	override LDLIBS += -lcap
diff --git a/test/zdtm/transition/Makefile b/test/zdtm/transition/Makefile
index a5ca99f..4466333 100644
--- a/test/zdtm/transition/Makefile
+++ b/test/zdtm/transition/Makefile
@@ -1,4 +1,5 @@
 include ../Makefile.inc
+.SUFFIXES:	# No implicit rules
 
 LIBDIR	= ../lib
 LIB	= $(LIBDIR)/libzdtmtst.a
@@ -40,9 +41,15 @@ DEP	= $(SRC:%.c=%.d)
 PID	= $(TST:%=%.pid)
 OUT	= $(TST:%=%.out)
 
-%: %.c
-	$(Q)echo $@ >> .gitignore
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LOADLIBES) $^ $(LDLIBS) -o $@
+%.o: %.c
+	@echo $@ >> .gitignore
+	$(E) " CC       " $@
+	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+%: %.o
+	@echo $@ >> .gitignore
+	$(E) " LINK     " $@
+	$(Q)$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
 
 all:	$(TST)
 install: all
@@ -74,7 +81,7 @@ wait_stop:
 		sleep 1; \
 	done
 
-$(TST):	$(LIB)
+$(TST):	| $(LIB)
 
 file_aio:	override LDLIBS += -lrt -pthread
 socket-tcp:	override CFLAGS += -D STREAM
-- 
2.9.3



More information about the CRIU mailing list