[CRIU] [PATCH 1/4] make: move syscalls files and build to separated directory
Kinsbursky Stanislav
skinsbursky at openvz.org
Fri Nov 2 11:39:53 EDT 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
0 files changed, 0 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/Makefile b/Makefile
index 5574b8c..0f457c8 100644
--- a/Makefile
+++ b/Makefile
@@ -50,21 +50,23 @@ DEPS := $(patsubst %.o,%.d,$(OBJS))
MAKEFLAGS += --no-print-directory
-include Makefile.syscall
include Makefile.pie
.PHONY: all zdtm test rebuild clean distclean tags cscope \
- docs help pie protobuf
+ docs help pie protobuf syscall
all: pie
$(Q) $(MAKE) $(PROGRAM)
-pie: protobuf
+pie: protobuf syscall
$(Q) $(MAKE) $(PIE-GEN)
protobuf:
$(Q) $(MAKE) -C protobuf/
+syscall:
+ $(Q) $(MAKE) -C syscall/
+
%.o: %.c
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $< -o $@
@@ -81,7 +83,7 @@ protobuf:
$(E) " DEP " $@
$(Q) $(CC) -M -MT $@ -MT $(patsubst %.d,%.o,$@) $(CFLAGS) $< -o $@
-$(PROGRAM): $(OBJS) $(SYS-OBJ) $(PROTOBUF-LIB)
+$(PROGRAM): $(OBJS) $(SYSCALL-LIB) $(PROTOBUF-LIB)
$(E) " LINK " $@
$(Q) $(CC) $(CFLAGS) $^ $(LIBS) -o $@
@@ -99,7 +101,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
@@ -110,6 +112,7 @@ clean: cleanpie cleansyscall
$(Q) $(RM) -f ./$(PROGRAM)
$(Q) $(RM) -rf ./test/dump/
$(Q) $(MAKE) -C protobuf/ clean
+ $(Q) $(MAKE) -C syscall/ 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 722cbfc..717e1ca 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -69,3 +69,5 @@ WARNINGS += -Wall
CFLAGS += $(WARNINGS) $(DEFINES)
export CC ECHO MAKE CFLAGS LIBS ARCH DEFINES
+
+SYSCALL-LIB := syscall/syscall-x86-64.o
diff --git a/Makefile.pie b/Makefile.pie
index d5caccb..99e3593 100644
--- a/Makefile.pie
+++ b/Makefile.pie
@@ -27,19 +27,19 @@ PIELDS := pie.lds.S
PIEFLAGS := -fpie -Wa,--noexecstack -fno-strict-aliasing
ASMFLAGS := -D__ASSEMBLY__
-$(PASM-OBJS): $(PASM-SRC) $(SYS-OBJ)
+$(PASM-OBJS): $(PASM-SRC) $(SYSCALL-LIB)
$(E) " CC " $@
$(Q) $(CC) -c $(ASMFLAGS) $(CFLAGS) $(PIEFLAGS) $(patsubst %.o,%.S,$@) -o $@
-$(POBJS): $(PSRCS) $(PASM-OBJS) $(SYS-OBJ)
+$(POBJS): $(PSRCS) $(PASM-OBJS) $(SYSCALL-LIB)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $(PIEFLAGS) $(patsubst %.o,%.c,$@) -o $@
-parasite-util-net.o: util-net.c $(SYS-OBJ)
+parasite-util-net.o: util-net.c $(SYSCALL-LIB)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $(PIEFLAGS) $< -o $@
-parasite-log.o: log-simple.c $(SYS-OBJ)
+parasite-log.o: log-simple.c $(SYSCALL-LIB)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $(PIEFLAGS) $< -o $@
@@ -47,27 +47,27 @@ POBJS += parasite-util-net.o parasite-log.o
$(PBLOB-BIN-O): $(PIELDS) $(POBJS) $(PASM-OBJS)
$(E) " GEN " $@
- $(Q) $(LD) --oformat=elf64-x86-64 -T $(PIELDS) -o $(PBLOB-BIN).o $(POBJS) $(PASM-OBJS) $(SYS-OBJ)
+ $(Q) $(LD) --oformat=elf64-x86-64 -T $(PIELDS) -o $(PBLOB-BIN).o $(POBJS) $(PASM-OBJS) $(SYSCALL-LIB)
$(PBLOB-BIN): $(PBLOB-BIN-O) $(PIELDS) $(POBJS) $(PASM-OBJS)
$(E) " GEN " $@
- $(Q) $(LD) --oformat=binary -T $(PIELDS) -o $(PBLOB-BIN) $(POBJS) $(PASM-OBJS) $(SYS-OBJ)
+ $(Q) $(LD) --oformat=binary -T $(PIELDS) -o $(PBLOB-BIN) $(POBJS) $(PASM-OBJS) $(SYSCALL-LIB)
$(PBLOB-HDR): $(PBLOB-BIN) $(GEN-OFFSETS)
$(E) " GEN " $@
$(Q) $(SH) $(GEN-OFFSETS) $(PBLOB-NAME) > $@ || rm -f $@
-$(ROBJS): $(RSRCS) $(SYS-OBJ)
+$(ROBJS): $(RSRCS) $(SYSCALL-LIB)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $(PIEFLAGS) $(patsubst %.o,%.c,$@) -o $@
$(RBLOB-BIN-O): $(PIELDS) $(ROBJS)
$(E) " GEN " $@
- $(Q) $(LD) --oformat=elf64-x86-64 -T $(PIELDS) -o $(RBLOB-BIN).o $(ROBJS) $(SYS-OBJ)
+ $(Q) $(LD) --oformat=elf64-x86-64 -T $(PIELDS) -o $(RBLOB-BIN).o $(ROBJS) $(SYSCALL-LIB)
$(RBLOB-BIN): $(RBLOB-BIN-O) $(PIELDS) $(ROBJS)
$(E) " GEN " $@
- $(Q) $(LD) --oformat=binary -T $(PIELDS) -o $(RBLOB-BIN) $(ROBJS) $(SYS-OBJ)
+ $(Q) $(LD) --oformat=binary -T $(PIELDS) -o $(RBLOB-BIN) $(ROBJS) $(SYSCALL-LIB)
$(RBLOB-HDR): $(RBLOB-BIN) $(GEN-OFFSETS)
$(E) " GEN " $@
diff --git a/Makefile.syscall b/Makefile.syscall
deleted file mode 100644
index 29e61a7..0000000
--- a/Makefile.syscall
+++ /dev/null
@@ -1,34 +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-OBJ := $(patsubst %.S,%.o,$(SYS-ASM))
-
-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)
-
-$(SYS-OBJ): $(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)
diff --git a/syscall-common-x86-64.S b/syscall-common-x86-64.S
deleted file mode 100644
index 84bcd8b..0000000
--- a/syscall-common-x86-64.S
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "linkage.h"
-
-#define SYSCALL(name, opcode) \
- ENTRY(name); \
- movl $opcode, %eax; \
- jmp __syscall_common; \
- END(name)
-
- .text
- .align 4
-
-ENTRY(__syscall_common)
- movq %rcx, %r10
- syscall
- ret
-END(__syscall_common)
diff --git a/syscall/Makefile b/syscall/Makefile
new file mode 100644
index 0000000..90eea77
--- /dev/null
+++ b/syscall/Makefile
@@ -0,0 +1,43 @@
+include ../Makefile.inc
+
+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-OBJ := $(patsubst %.S,%.o,$(SYS-ASM))
+
+SYS-FLAGS := -fpie -Wstrict-prototypes -Wa,--noexecstack -D__ASSEMBLY__ -nostdlib -fomit-frame-pointer
+
+.DEFAULT_GOAL := syscalls
+
+$(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) -c $(CFLAGS) $(SYS-FLAGS) $< -o $@
+
+syscalls: $(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 syscalls
diff --git a/syscall/syscall-common-x86-64.S b/syscall/syscall-common-x86-64.S
new file mode 100644
index 0000000..7802d50
--- /dev/null
+++ b/syscall/syscall-common-x86-64.S
@@ -0,0 +1,16 @@
+#include "../include/linkage.h"
+
+#define SYSCALL(name, opcode) \
+ ENTRY(name); \
+ movl $opcode, %eax; \
+ jmp __syscall_common; \
+ END(name)
+
+ .text
+ .align 4
+
+ENTRY(__syscall_common)
+ movq %rcx, %r10
+ syscall
+ ret
+END(__syscall_common)
diff --git a/syscall/syscalls-x86-64.sh b/syscall/syscalls-x86-64.sh
new file mode 100644
index 0000000..7a54bcd
--- /dev/null
+++ b/syscall/syscalls-x86-64.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+in=$1
+codesout=$2
+codes=`echo $2`
+protosout=$3
+protos=`echo $3`
+asmout=$4
+asmcommon=$5
+prototypes=`echo $6 | sed -e 's/\.\.\/include\///g'`
+
+codeslocal=`echo $codes | sed -e 's/\.\.\/include\///g'`
+
+codesdef=`echo $codes_local | tr "[[:space:]].-" _`
+protosdef=`echo $protos | sed -e 's/\/include\///g' | tr "[[:space:]].-" _`
+
+echo "/* Autogenerated, don't edit */" > $codesout
+echo "#ifndef $codesdef" >> $codesout
+echo "#define $codesdef" >> $codesout
+
+echo "/* Autogenerated, don't edit */" > $protosout
+echo "#ifndef $protosdef" >> $protosout
+echo "#define $protosdef" >> $protosout
+echo "#include \"$prototypes\"" >> $protosout
+echo "#include \"$codeslocal\"" >> $protosout
+
+echo "/* Autogenerated, don't edit */" > $asmout
+echo "#include \"$codes\"" >> $asmout
+echo "#include \"$asmcommon\"" >> $asmout
+
+cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "#define", $1, $2}' >> $codesout
+cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "extern long ", $3, $4, ";"}' >> $protosout
+cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "SYSCALL(", $3, ",", $2, ")"}' >> $asmout
+
+echo "#endif /* $codesdef */" >> $codesout
+echo "#endif /* $protosdef */" >> $protosout
diff --git a/syscalls-x86-64.sh b/syscalls-x86-64.sh
deleted file mode 100644
index b0a5c4f..0000000
--- a/syscalls-x86-64.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-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'`
-
-codesdef=`echo $codes | tr "[[:space:]].-" _`
-protosdef=`echo $protos | tr "[[:space:]].-" _`
-
-echo "/* Autogenerated, don't edit */" > $codesout
-echo "#ifndef $codesdef" >> $codesout
-echo "#define $codesdef" >> $codesout
-
-echo "/* Autogenerated, don't edit */" > $protosout
-echo "#ifndef $protosdef" >> $protosout
-echo "#define $protosdef" >> $protosout
-echo "#include \"$prototypes\"" >> $protosout
-echo "#include \"$codes\"" >> $protosout
-
-echo "/* Autogenerated, don't edit */" > $asmout
-echo "#include \"$codes\"" >> $asmout
-echo "#include \"$asmcommon\"" >> $asmout
-
-cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "#define", $1, $2}' >> $codesout
-cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "extern long ", $3, $4, ";"}' >> $protosout
-cat $in | egrep -v '^#' | sed -e 's/\t\{1,\}/|/g' | awk -F '|' '{print "SYSCALL(", $3, ",", $2, ")"}' >> $asmout
-
-echo "#endif /* $codesdef */" >> $codesout
-echo "#endif /* $protosdef */" >> $protosout
More information about the CRIU
mailing list