[CRIU] [PATCH 2/4] build: syscalls -- Use ifdef form for inclusion together with system headers

Cyrill Gorcunov gorcunov at openvz.org
Tue Mar 15 05:41:08 PDT 2016


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/arch/ppc64/Makefile.syscalls     | 2 +-
 criu/arch/scripts/arm/gen-syscalls.pl | 4 +++-
 criu/arch/x86/Makefile.syscalls       | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/criu/arch/ppc64/Makefile.syscalls b/criu/arch/ppc64/Makefile.syscalls
index 76e4caf72fc6..f3431a7bc670 100644
--- a/criu/arch/ppc64/Makefile.syscalls
+++ b/criu/arch/ppc64/Makefile.syscalls
@@ -20,7 +20,7 @@ $(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
 	$(Q) echo "/* Autogenerated, don't edit */"							>  $@
 	$(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__"							>> $@
 	$(Q) echo "#define __ASM_CR_SYSCALL_CODES_H__"							>> $@
-	$(Q) cat $< | awk '/^__NR/{print "#define", $$1, $$2}'						>> $@
+	$(Q) cat $< | awk '/^__NR/{print "#ifndef",$$1,"\n# define",$$1,$$2,"\n#endif"}'		>> $@
 	$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */"						>> $@
 cleanup-y		+= $(obj)/$(SYS-CODES)
 
diff --git a/criu/arch/scripts/arm/gen-syscalls.pl b/criu/arch/scripts/arm/gen-syscalls.pl
index 6fb8f3bf2071..149f32d4e5b7 100755
--- a/criu/arch/scripts/arm/gen-syscalls.pl
+++ b/criu/arch/scripts/arm/gen-syscalls.pl
@@ -76,7 +76,9 @@ for (<IN>) {
 	}
 
 	if ($+{$code} ne "!") {
-		print CODESOUT "#define $code_macro $+{$code}\n";
+		print CODESOUT "#ifndef $code_macro\n";
+		print CODESOUT "# define $code_macro $+{$code}\n";
+		print CODESOUT "#endif\n";
 		print ASMOUT "syscall $sys_name, $code_macro\n";
 
 	} else {
diff --git a/criu/arch/x86/Makefile.syscalls b/criu/arch/x86/Makefile.syscalls
index 6c1a56af57a3..c07d5585c943 100644
--- a/criu/arch/x86/Makefile.syscalls
+++ b/criu/arch/x86/Makefile.syscalls
@@ -31,7 +31,7 @@ $(obj)/$(SYS-CODES): $(obj)/syscalls/$(SYS-DEF)
 	$(Q) echo "/* Autogenerated, don't edit */"							>  $@
 	$(Q) echo "#ifndef __ASM_CR_SYSCALL_CODES_H__"							>> $@
 	$(Q) echo "#define __ASM_CR_SYSCALL_CODES_H__"							>> $@
-	$(Q) cat $< | awk '/^__NR/{print "#define", $$1, $$2}'						>> $@
+	$(Q) cat $< | awk '/^__NR/{print "#ifndef",$$1,"\n# define",$$1,$$2,"\n#endif"}'		>> $@
 	$(Q) echo "#endif /* __ASM_CR_SYSCALL_CODES_H__ */"						>> $@
 cleanup-y		+= $(obj)/$(SYS-CODES)
 
-- 
2.5.0



More information about the CRIU mailing list