[CRIU] [PATCH v4 2/4] make: move pie files and build to separated directory
Kinsbursky Stanislav
skinsbursky at openvz.org
Mon Nov 19 10:35:21 EST 2012
From: Stanislav Kinsbursky <skinsbursky at openvz.org>
Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
Makefile | 7 +++----
Makefile.inc | 2 +-
pie/Makefile | 15 +++++++++++----
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 +-
9 files changed, 16 insertions(+), 10 deletions(-)
rename Makefile.pie => pie/Makefile (90%)
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%)
-------------- next part --------------
diff --git a/Makefile b/Makefile
index 4bf98db..36a103a 100644
--- a/Makefile
+++ b/Makefile
@@ -48,8 +48,6 @@ PROTOBUF-LIB := protobuf/protobuf-lib.o
DEPS := $(patsubst %.o,%.d,$(OBJS))
-include Makefile.pie
-
.PHONY: all zdtm test rebuild clean distclean tags cscope \
docs help pie protobuf x86_64
@@ -57,7 +55,7 @@ all: pie
$(Q) $(MAKE) $(PROGRAM)
pie: protobuf $(ARCH)
- $(Q) $(MAKE) $(PIE-GEN)
+ $(Q) $(MAKE) -C pie/
protobuf:
$(Q) $(MAKE) -C protobuf/
@@ -99,7 +97,7 @@ rebuild:
$(Q) $(RM) -f ./protobuf/*.pb-c.h
$(Q) $(MAKE)
-clean: cleanpie
+clean:
$(E) " CLEAN"
$(Q) $(RM) -f ./*.o
$(Q) $(RM) -f ./*.d
@@ -111,6 +109,7 @@ clean: cleanpie
$(Q) $(RM) -rf ./test/dump/
$(Q) $(MAKE) -C protobuf/ clean
$(Q) $(MAKE) -C x86_64/ 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 d59a76b..bae9a36 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -72,5 +72,5 @@ CFLAGS += $(WARNINGS) $(DEFINES)
MAKEFLAGS += --no-print-directory
SYSCALL-LIB ?= $(SRC_DIR)/x86_64/syscall-x86-64.o
-export CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS SRC_DIR SYSCALL-LIB
+export CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS SRC_DIR SYSCALL-LIB SH
diff --git a/Makefile.pie b/pie/Makefile
similarity index 90%
rename from Makefile.pie
rename to pie/Makefile
index 99e3593..3e06f00 100644
--- a/Makefile.pie
+++ b/pie/Makefile
@@ -1,3 +1,7 @@
+CFLAGS += -I../include/ -I../protobuf/ -I../syscall/
+
+include ../Makefile.inc
+
GEN-OFFSETS := gen-offsets.sh
PASM-OBJS += parasite-head-x86-64.o
@@ -27,6 +31,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 $@
@@ -35,7 +41,7 @@ $(POBJS): $(PSRCS) $(PASM-OBJS) $(SYSCALL-LIB)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $(PIEFLAGS) $(patsubst %.o,%.c,$@) -o $@
-parasite-util-net.o: util-net.c $(SYSCALL-LIB)
+parasite-util-net.o: $(SRC_DIR)/util-net.c $(SYSCALL-LIB)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $(PIEFLAGS) $< -o $@
@@ -73,12 +79,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 7b2d3ef..85a6da4 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) \
({ \
More information about the CRIU
mailing list