[CRIU] [PATCH 02/24] compel/test: Makefiles cleanup

Kir Kolyshkin kir at openvz.org
Sat Dec 17 03:21:55 PST 2016


1. Remove COMMON_IDIR -- there's no need for it, and it makes
   the build process look more complicated than it is.

2. Use standard CC and CFLAGS defines (so one can use say make CC=clang)

3. Drop the dependency on COMPEL_LIBRARY, as it's supposed to be
   an external file/tool.

4. Add -Wall to CFLAGS.

5. Simplify ARCH setting in infect test.

6. Drop ARCH from rsys test, as it's not used there.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 compel/test/infect/Makefile | 16 +++++++---------
 compel/test/rsys/Makefile   | 13 +++++--------
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/compel/test/infect/Makefile b/compel/test/infect/Makefile
index 65c1728..f244755 100644
--- a/compel/test/infect/Makefile
+++ b/compel/test/infect/Makefile
@@ -1,9 +1,7 @@
-ifeq ($(ARCH),)
-        ARCH := x86
-endif
+CC	:= gcc
+CFLAGS	?= -O2 -g -Wall -Werror
+ARCH	?= x86
 
-# FIXME -- generate common symlink in compel/uapi
-COMMON_IDIR	:= ../../../include
 COMPEL		:= ../../../compel/compel-host
 COMPEL_IDIR	:= ../../../compel/include/uapi
 COMPEL_PACK_LDS	:= ../../../compel/arch/$(ARCH)/scripts/compel-pack.lds.S
@@ -20,10 +18,10 @@ clean:
 	rm -f parasite.o
 
 victim: victim.c
-	gcc -o $@ $^
+	$(CC) $(CFLAGS) -o $@ $^
 
-spy: spy.c $(COMPEL_LIBRARY) | parasite.h
-	gcc -Werror -I$(COMPEL_IDIR) -I$(COMMON_IDIR) -o $@ $^
+spy: spy.c | parasite.h
+	$(CC) $(CFLAGS) -I$(COMPEL_IDIR) -o $@ $^ $(COMPEL_LIBRARY)
 
 parasite.h: parasite.po
 	$(COMPEL) hgen -f $^ -l 4		\
@@ -34,4 +32,4 @@ parasite.po: parasite.o $(COMPEL_PLUGINS)/std.built-in.o
 	ld -r -T $(COMPEL_PACK_LDS) -o $@ $^
 
 parasite.o: parasite.c
-	gcc -c $(shell $(COMPEL) --arch=$(ARCH) cflags) -I$(COMPEL_IDIR) -o $@ $^
+	$(CC) $(CFLAGS) -c $(shell $(COMPEL) --arch=$(ARCH) cflags) -I$(COMPEL_IDIR) -o $@ $^
diff --git a/compel/test/rsys/Makefile b/compel/test/rsys/Makefile
index cd66488..a4fda54 100644
--- a/compel/test/rsys/Makefile
+++ b/compel/test/rsys/Makefile
@@ -1,9 +1,6 @@
-ifeq ($(ARCH),)
-        ARCH := x86
-endif
+CC	:= gcc
+CFLAGS	?= -O2 -g -Wall -Werror
 
-# FIXME -- generate common symlink in compel/uapi
-COMMON_IDIR	:= ../../../include
 COMPEL_IDIR	:= ../../../compel/include/uapi
 COMPEL_LIBRARY	:= ../../../compel/libcompel.a
 
@@ -14,7 +11,7 @@ clean:
 	rm -f spy
 
 victim: victim.c
-	gcc -o $@ $^
+	$(CC) $(CFLAGS) -o $@ $^
 
-spy: spy.c $(COMPEL_LIBRARY)
-	gcc -Werror -I$(COMPEL_IDIR) -I$(COMMON_IDIR) -o $@ $^
+spy: spy.c
+	$(CC) $(CFLAGS) -I$(COMPEL_IDIR) -o $@ $^ $(COMPEL_LIBRARY)
-- 
2.7.4



More information about the CRIU mailing list