[CRIU] [PATCH v3 2/4] make: move pie files and build to separated directory

Kinsbursky Stanislav skinsbursky at openvz.org
Fri Nov 9 03:02:51 EST 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 Makefile                   |   10 +++++-----
 Makefile.inc               |    4 +---
 pie/Makefile               |   14 +++++++++++---
 pie/gen-offsets.sh         |    0 
 pie/log-simple.c           |    0 
 pie/parasite-head-x86-64.S |    0 
 pie/parasite.c             |    0 
 pie/pie.lds.S              |    0 
 pie/restorer.c             |    2 +-
 pie/util-net.c             |    0 
 10 files changed, 18 insertions(+), 12 deletions(-)
 rename Makefile.pie => pie/Makefile (91%)
 rename gen-offsets.sh => pie/gen-offsets.sh (100%)
 rename log-simple.c => pie/log-simple.c (100%)
 rename parasite-head-x86-64.S => pie/parasite-head-x86-64.S (100%)
 rename parasite.c => pie/parasite.c (100%)
 rename pie.lds.S => pie/pie.lds.S (100%)
 rename restorer.c => pie/restorer.c (99%)
 rename util-net.c => pie/util-net.c (100%)
-------------- next part --------------
diff --git a/Makefile b/Makefile
index 0f457c8..cfc7b3b 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ OBJS		+= cr-dump.o
 OBJS		+= cr-show.o
 OBJS		+= cr-check.o
 OBJS		+= util.o
-OBJS		+= util-net.o
+OBJS		+= pie/util-net.o
 OBJS		+= sysctl.o
 OBJS		+= ptrace.o
 OBJS		+= kcmp-ids.o
@@ -45,13 +45,12 @@ OBJS		+= protobuf.o
 OBJS		+= tty.o
 
 PROTOBUF-LIB	:= protobuf/protobuf-lib.o
+SYSCALL-LIB	:= syscall/syscall-x86-64.o
 
 DEPS		:= $(patsubst %.o,%.d,$(OBJS))
 
 MAKEFLAGS	+= --no-print-directory
 
-include Makefile.pie
-
 .PHONY: all zdtm test rebuild clean distclean tags cscope	\
 	docs help pie protobuf syscall
 
@@ -59,7 +58,7 @@ all: pie
 	$(Q) $(MAKE) $(PROGRAM)
 
 pie: protobuf syscall
-	$(Q) $(MAKE) $(PIE-GEN)
+	$(Q) $(MAKE) -C pie/
 
 protobuf:
 	$(Q) $(MAKE) -C protobuf/
@@ -101,7 +100,7 @@ rebuild:
 	$(Q) $(RM) -f ./protobuf/*.pb-c.h
 	$(Q) $(MAKE)
 
-clean: cleanpie
+clean:
 	$(E) "  CLEAN"
 	$(Q) $(RM) -f ./*.o
 	$(Q) $(RM) -f ./*.d
@@ -113,6 +112,7 @@ clean: cleanpie
 	$(Q) $(RM) -rf ./test/dump/
 	$(Q) $(MAKE) -C protobuf/ clean
 	$(Q) $(MAKE) -C syscall/ clean
+	$(Q) $(MAKE) -C pie/ 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 717e1ca..fd12927 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -43,7 +43,7 @@ endif
 
 no-deps-targets := tags cscope clean cleanout cleandep realclean
 
-CFLAGS		+= -I./include -fno-strict-aliasing
+CFLAGS		+= -I./include -I./pie -fno-strict-aliasing
 
 LIBS		+= -lrt -lpthread -lprotobuf-c
 
@@ -69,5 +69,3 @@ 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/pie/Makefile
similarity index 91%
rename from Makefile.pie
rename to pie/Makefile
index 99e3593..119e837 100644
--- a/Makefile.pie
+++ b/pie/Makefile
@@ -1,3 +1,8 @@
+SYSCALL-LIB	:= ../syscall/syscall-x86-64.o
+CFLAGS		+= -I../include/ -I../protobuf/ -I../syscall/
+
+include ../Makefile.inc
+
 GEN-OFFSETS	:= gen-offsets.sh
 
 PASM-OBJS	+= parasite-head-x86-64.o
@@ -27,6 +32,8 @@ PIELDS		:= pie.lds.S
 PIEFLAGS	:= -fpie  -Wa,--noexecstack -fno-strict-aliasing
 ASMFLAGS	:= -D__ASSEMBLY__
 
+.DEFAULT_GOAL	:= pie
+
 $(PASM-OBJS): $(PASM-SRC) $(SYSCALL-LIB)
 	$(E) "  CC      " $@
 	$(Q) $(CC) -c $(ASMFLAGS) $(CFLAGS) $(PIEFLAGS) $(patsubst %.o,%.S,$@) -o $@
@@ -73,12 +80,13 @@ $(RBLOB-HDR): $(RBLOB-BIN) $(GEN-OFFSETS)
 	$(E) "  GEN     " $@
 	$(Q) $(SH) $(GEN-OFFSETS) $(RBLOB-NAME) > $@ || rm -f $@
 
-PIE-GEN	:= $(PBLOB-HDR) $(RBLOB-HDR)
+pie: $(PBLOB-HDR) $(RBLOB-HDR)
 
-cleanpie:
+clean:
 	$(E) "  CLEAN PIE"
 	$(Q) $(RM) -f ./$(PBLOB-HDR)
 	$(Q) $(RM) -f ./$(RBLOB-HDR)
+	$(Q) $(RM) -f ./*.o
 	$(Q) $(RM) -f ./*.bin
 	$(Q) $(RM) -f ./*.bin.o
-.PHONY: cleanpie
+.PHONY: clean pie
diff --git a/gen-offsets.sh b/pie/gen-offsets.sh
similarity index 100%
rename from gen-offsets.sh
rename to pie/gen-offsets.sh
diff --git a/log-simple.c b/pie/log-simple.c
similarity index 100%
rename from log-simple.c
rename to pie/log-simple.c
diff --git a/parasite-head-x86-64.S b/pie/parasite-head-x86-64.S
similarity index 100%
rename from parasite-head-x86-64.S
rename to pie/parasite-head-x86-64.S
diff --git a/parasite.c b/pie/parasite.c
similarity index 100%
rename from parasite.c
rename to pie/parasite.c
diff --git a/pie.lds.S b/pie/pie.lds.S
similarity index 100%
rename from pie.lds.S
rename to pie/pie.lds.S
diff --git a/restorer.c b/pie/restorer.c
similarity index 99%
rename from restorer.c
rename to pie/restorer.c
index 7d3cef5..e06cf24 100644
--- a/restorer.c
+++ b/pie/restorer.c
@@ -25,7 +25,7 @@
 #include "lock.h"
 #include "restorer.h"
 
-#include "protobuf/creds.pb-c.h"
+#include "creds.pb-c.h"
 
 #define sys_prctl_safe(opcode, val1, val2, val3)			\
 	({								\
diff --git a/util-net.c b/pie/util-net.c
similarity index 100%
rename from util-net.c
rename to pie/util-net.c


More information about the CRIU mailing list