[CRIU] [RFC 03/11] Always use ARCH_DIR

Christopher Covington cov at codeaurora.org
Fri Feb 7 09:04:37 PST 2014


The top-level makefile defines an ARCH_DIR variable. Always use
it rather than referencing ARCH directly, since ARCH may be set
by the user on the command line and that raw input may not be
what needs to be used internally.
---
 Makefile         | 20 ++++++++++----------
 Makefile.crtools |  2 +-
 lib/Makefile     |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 96c3c1e..16d86b2 100644
--- a/Makefile
+++ b/Makefile
@@ -98,8 +98,8 @@ else
 endif
 
 CFLAGS		+= $(WARNINGS) $(DEFINES)
-SYSCALL-LIB	:= arch/$(ARCH)/syscalls.built-in.o
-ARCH-LIB	:= arch/$(ARCH)/crtools.built-in.o
+SYSCALL-LIB	:= $(ARCH_DIR)/syscalls.built-in.o
+ARCH-LIB	:= $(ARCH_DIR)/crtools.built-in.o
 CRIU-LIB	:= lib/libcriu.so
 
 export CC MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
@@ -121,7 +121,7 @@ build-crtools := -r -R -f scripts/Makefile.build makefile=Makefile.crtools obj
 PROGRAM		:= criu
 
 .PHONY: all zdtm test rebuild clean distclean tags cscope	\
-	docs help pie protobuf arch/$(ARCH) clean-built lib
+	docs help pie protobuf $(ARCH_DIR) clean-built lib
 
 ifeq ($(GCOV),1)
 %.o $(PROGRAM): override CFLAGS += --coverage
@@ -135,14 +135,14 @@ protobuf/%::
 protobuf:
 	$(Q) $(MAKE) $(build)=protobuf all
 
-arch/$(ARCH)/%:: protobuf
-	$(Q) $(MAKE) $(build)=arch/$(ARCH) $@
-arch/$(ARCH): protobuf
-	$(Q) $(MAKE) $(build)=arch/$(ARCH) all
+$(ARCH_DIR)/%:: protobuf
+	$(Q) $(MAKE) $(build)=$(ARCH_DIR) $@
+$(ARCH_DIR): protobuf
+	$(Q) $(MAKE) $(build)=$(ARCH_DIR) all
 
-pie/%:: arch/$(ARCH)
+pie/%:: $(ARCH_DIR)
 	$(Q) $(MAKE) $(build)=pie $@
-pie: arch/$(ARCH)
+pie: $(ARCH_DIR)
 	$(Q) $(MAKE) $(build)=pie all
 
 %.o %.i %.s %.d: $(VERSION_HEADER) pie
@@ -176,7 +176,7 @@ test: zdtm
 
 clean-built:
 	$(Q) $(RM) $(VERSION_HEADER)
-	$(Q) $(MAKE) $(build)=arch/$(ARCH) clean
+	$(Q) $(MAKE) $(build)=$(ARCH_DIR) clean
 	$(Q) $(MAKE) $(build)=protobuf clean
 	$(Q) $(MAKE) $(build)=pie clean
 	$(Q) $(MAKE) $(build)=lib clean
diff --git a/Makefile.crtools b/Makefile.crtools
index 094013e..374cd85 100644
--- a/Makefile.crtools
+++ b/Makefile.crtools
@@ -57,7 +57,7 @@ obj-y	+= kerndat.o
 obj-y	+= stats.o
 obj-y	+= string.o
 obj-y	+= sigframe.o
-obj-y	+= arch/$(ARCH)/vdso.o
+obj-y	+= $(ARCH_DIR)/vdso.o
 obj-y	+= cr-service.o
 obj-y	+= sd-daemon.o
 obj-y	+= plugin.o
diff --git a/lib/Makefile b/lib/Makefile
index bbe5ec1..a468b40 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -2,7 +2,7 @@ lib-so			+= libcriu
 obj-y			+= criu.o
 obj-ext-src-y		+= protobuf/rpc.pb-c.o
 
-includes		+= -iquote $(obj)/../arch/$(ARCH)/include -iquote $(obj)/../include -iquote $(obj)/.. -iquote $(obj)/../protobuf
+includes		+= -iquote $(obj)/../$(ARCH_DIR)/include -iquote $(obj)/../include -iquote $(obj)/.. -iquote $(obj)/../protobuf
 cflags-y		+= $(includes) -fPIC -Wa,--noexecstack -fno-stack-protector
 cflags-so		+= $(CFLAGS) -rdynamic
 ldflags-so		+= -lprotobuf-c
-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.



More information about the CRIU mailing list