[CRIU] [PATCH v5 2/5] make: move syscalls files and build to separated directory
Kinsbursky Stanislav
skinsbursky at openvz.org
Wed Nov 21 07:50:51 EST 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
This patch set moves all syscalls data to "arch/$(ARCH)" directory ("arch/x86"
in this particular case).
It does also some cleanup to syscalls-x86-64.sh.
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
Makefile | 11 ++++++----
Makefile.inc | 2 +-
Makefile.syscall | 33 -------------------------------
arch/x86/Makefile | 41 ++++++++++++++++++++++++++++++++++++++
arch/x86/syscall-common-x86-64.S | 0
arch/x86/syscalls-x86-64.sh | 12 +++++------
6 files changed, 54 insertions(+), 45 deletions(-)
delete mode 100644 Makefile.syscall
create mode 100644 arch/x86/Makefile
rename syscall-common-x86-64.S => arch/x86/syscall-common-x86-64.S (100%)
rename syscalls-x86-64.sh => arch/x86/syscalls-x86-64.sh (74%)
-------------- next part --------------
diff --git a/Makefile b/Makefile
index 772bef2..bed7ee1 100644
--- a/Makefile
+++ b/Makefile
@@ -46,21 +46,23 @@ OBJS += tty.o
DEPS := $(patsubst %.o,%.d,$(OBJS))
-include Makefile.syscall
include Makefile.pie
.PHONY: all zdtm test rebuild clean distclean tags cscope \
- docs help pie protobuf
+ docs help pie protobuf x86
all: pie
$(Q) $(MAKE) $(PROGRAM)
-pie: protobuf
+pie: protobuf $(ARCH)
$(Q) $(MAKE) $(PIE-GEN)
protobuf:
$(Q) $(MAKE) -C protobuf/
+x86:
+ $(Q) $(MAKE) -C arch/x86/
+
%.o: %.c
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $< -o $@
@@ -95,7 +97,7 @@ rebuild:
$(Q) $(RM) -f ./protobuf/*.pb-c.h
$(Q) $(MAKE)
-clean: cleanpie cleansyscall
+clean: cleanpie
$(E) " CLEAN"
$(Q) $(RM) -f ./*.o
$(Q) $(RM) -f ./*.d
@@ -106,6 +108,7 @@ clean: cleanpie cleansyscall
$(Q) $(RM) -f ./$(PROGRAM)
$(Q) $(RM) -rf ./test/dump/
$(Q) $(MAKE) -C protobuf/ clean
+ $(Q) $(MAKE) -C arch/x86/ clean
$(Q) $(MAKE) -C test/zdtm cleandep
$(Q) $(MAKE) -C test/zdtm clean
$(Q) $(MAKE) -C test/zdtm cleanout
diff --git a/Makefile.inc b/Makefile.inc
index f41e21c..2b34197 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -68,7 +68,7 @@ endif
CFLAGS += $(WARNINGS) $(DEFINES)
MAKEFLAGS := --no-print-directory
-SYSCALL-LIB = $(SRC_DIR)/syscall-x86-64.o
+SYSCALL-LIB = $(SRC_DIR)/arch/$(ARCH)/syscalls.o
PROTOBUF-LIB = $(SRC_DIR)/protobuf/protobuf-lib.o
export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS SRC_DIR SYSCALL-LIB SH
diff --git a/Makefile.syscall b/Makefile.syscall
deleted file mode 100644
index f5e4efc..0000000
--- a/Makefile.syscall
+++ /dev/null
@@ -1,33 +0,0 @@
-SYS-DEF := include/syscall-x86-64.def
-SYS-ASM-COMMON := syscall-common-x86-64.S
-SYS-TYPES := include/syscall-types.h
-
-SYS-CODES := include/syscall-codes.h
-SYS-PROTO := include/syscall.h
-
-SYS-ASM := syscall-x86-64.S
-SYS-GEN := syscalls-x86-64.sh
-
-SYS-FLAGS := -fpie -Wstrict-prototypes -Wa,--noexecstack -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
-
-$(SYS-ASM): $(SYS-GEN) $(SYS-DEF) $(SYS-ASM-COMMON) $(SYS-TYPES)
- $(E) " GEN " $@
- $(Q) $(SH) \
- $(SYS-GEN) \
- $(SYS-DEF) \
- $(SYS-CODES) \
- $(SYS-PROTO) \
- $(SYS-ASM) \
- $(SYS-ASM-COMMON) \
- $(SYS-TYPES)
-
-$(SYSCALL-LIB): $(SYS-ASM)
- $(E) " CC " $@
- $(Q) $(CC) -c $(CFLAGS) $(SYS-FLAGS) $< -o $@
-
-cleansyscall:
- $(E) " CLEAN SYSCALLS"
- $(Q) $(RM) -f ./$(SYS-ASM)
- $(Q) $(RM) -f ./$(SYS-CODES)
- $(Q) $(RM) -f ./$(SYS-PROTO)
- $(Q) $(RM) -f ./$(SYSCALL-LIB)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
new file mode 100644
index 0000000..d81e0f7
--- /dev/null
+++ b/arch/x86/Makefile
@@ -0,0 +1,41 @@
+SYS-DEF := $(SRC_DIR)/include/syscall-x86-64.def
+SYS-ASM-COMMON := syscall-common-x86-64.S
+SYS-TYPES := $(SRC_DIR)/include/syscall-types.h
+
+SYS-CODES := $(SRC_DIR)/include/syscall-codes.h
+SYS-PROTO := $(SRC_DIR)/include/syscall.h
+
+SYS-ASM := syscalls.S
+SYS-GEN := syscalls-x86-64.sh
+
+SYS-OBJ := syscalls.o
+
+CFLAGS += -c -fpie -Wstrict-prototypes -Wa,--noexecstack -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer -I$(shell pwd)
+
+.DEFAULT_GOAL := x86
+
+$(SYS-ASM): $(SYS-GEN) $(SYS-DEF) $(SYS-ASM-COMMON) $(SYS-TYPES)
+ $(E) " GEN " $@
+ $(Q) $(SH) \
+ $(SYS-GEN) \
+ $(SYS-DEF) \
+ $(SYS-CODES) \
+ $(SYS-PROTO) \
+ $(SYS-ASM) \
+ $(SYS-ASM-COMMON) \
+ $(SYS-TYPES)
+
+%.o: %.S
+ $(E) " CC " $@
+ $(Q) $(CC) $(CFLAGS) $^ -o $@
+
+x86: $(SYS-OBJ)
+
+clean:
+ $(E) " CLEAN SYSCALLS"
+ $(Q) $(RM) -f $(SYS-ASM)
+ $(Q) $(RM) -f $(SYS-CODES)
+ $(Q) $(RM) -f $(SYS-PROTO)
+ $(Q) $(RM) -f $(SYS-OBJ)
+
+.PHONY: clean x86
diff --git a/syscall-common-x86-64.S b/arch/x86/syscall-common-x86-64.S
similarity index 100%
rename from syscall-common-x86-64.S
rename to arch/x86/syscall-common-x86-64.S
diff --git a/syscalls-x86-64.sh b/arch/x86/syscalls-x86-64.sh
similarity index 74%
rename from syscalls-x86-64.sh
rename to arch/x86/syscalls-x86-64.sh
index b0a5c4f..1372cd5 100644
--- a/syscalls-x86-64.sh
+++ b/arch/x86/syscalls-x86-64.sh
@@ -2,15 +2,13 @@
in=$1
codesout=$2
-codes=`echo $2 | sed -e 's/include\///g'`
protosout=$3
-protos=`echo $3 | sed -e 's/include\///g'`
asmout=$4
asmcommon=$5
-prototypes=`echo $6 | sed -e 's/include\///g'`
+prototypes=`echo $6 | sed -e 's/.*include\///g'`
-codesdef=`echo $codes | tr "[[:space:]].-" _`
-protosdef=`echo $protos | tr "[[:space:]].-" _`
+codesdef=`echo $codesout | sed -e 's/.*\/include\///g' | tr "[[:space:]].-" _`
+protosdef=`echo $protosout | sed -e 's/.*\/include\///g' | tr "[[:space:]].-" _`
echo "/* Autogenerated, don't edit */" > $codesout
echo "#ifndef $codesdef" >> $codesout
@@ -20,10 +18,10 @@ echo "/* Autogenerated, don't edit */" > $protosout
echo "#ifndef $protosdef" >> $protosout
echo "#define $protosdef" >> $protosout
echo "#include \"$prototypes\"" >> $protosout
-echo "#include \"$codes\"" >> $protosout
+echo "#include \"$codesout\"" >> $protosout
echo "/* Autogenerated, don't edit */" > $asmout
-echo "#include \"$codes\"" >> $asmout
+echo "#include \"$codesout\"" >> $asmout
echo "#include \"$asmcommon\"" >> $asmout
cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "#define", $1, $2}' >> $codesout
More information about the CRIU
mailing list