From 7d181cda7376a0ea97fecd9e5376aa09cd1e19ef Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sat, 17 Dec 2016 03:21:55 -0800 Subject: [PATCH] compel/test: Makefiles cleanup 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. travis-ci: success for More polishing for compel cli Signed-off-by: Kir Kolyshkin Acked-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov Signed-off-by: Andrei Vagin --- 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 65c17280f..f244755f6 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 cd664884a..a4fda54fa 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)