[CRIU] [PATCH 2/4] make: Move common definitions to Makefile.inc

Cyrill Gorcunov gorcunov at openvz.org
Sat Sep 1 08:39:22 EDT 2012


To eliminate code duplication.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile          |   27 ---------------------------
 Makefile.inc      |   31 +++++++++++++++++++++++++++++++
 protobuf/Makefile |   19 +------------------
 3 files changed, 32 insertions(+), 45 deletions(-)

diff --git a/Makefile b/Makefile
index b491741..c5ee775 100644
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,7 @@
 include Makefile.inc
 
-CFLAGS		+= -I./include -fno-strict-aliasing
-
-LIBS		+= -lrt -lpthread -lprotobuf-c
-
-DEFINES		+= -D_FILE_OFFSET_BITS=64
-DEFINES		+= -D_GNU_SOURCE
-
-ifneq ($(WERROR),0)
-	WARNINGS += -Werror
-endif
-
-ifeq ($(DEBUG),1)
-	DEFINES += -DCR_DEBUG
-endif
-
-ifeq ($(DEBUG),1)
-	DEFINES += -DCR_DEBUG
-	CFLAGS	+= -O0 -ggdb3
-else
-	CFLAGS	+= -O2
-endif
-
-WARNINGS	+= -Wall
-CFLAGS		+= $(WARNINGS) $(DEFINES)
-
 PROGRAM		:= crtools
 
-export CC ECHO MAKE CFLAGS LIBS ARCH DEFINES
-
 OBJS		+= parasite-syscall.o
 OBJS		+= cr-restore.o
 OBJS		+= crtools.o
diff --git a/Makefile.inc b/Makefile.inc
index ffa02d9..722cbfc 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -1,3 +1,7 @@
+#
+# Common definitions
+#
+
 ifeq ($(strip $(V)),)
 	E = @echo
 	Q = @
@@ -38,3 +42,30 @@ ifeq ($(uname_M),x86_64)
 endif
 
 no-deps-targets := tags cscope clean cleanout cleandep realclean
+
+CFLAGS		+= -I./include -fno-strict-aliasing
+
+LIBS		+= -lrt -lpthread -lprotobuf-c
+
+DEFINES		+= -D_FILE_OFFSET_BITS=64
+DEFINES		+= -D_GNU_SOURCE
+
+ifneq ($(WERROR),0)
+	WARNINGS += -Werror
+endif
+
+ifeq ($(DEBUG),1)
+	DEFINES += -DCR_DEBUG
+endif
+
+ifeq ($(DEBUG),1)
+	DEFINES += -DCR_DEBUG
+	CFLAGS	+= -O0 -ggdb3
+else
+	CFLAGS	+= -O2
+endif
+
+WARNINGS	+= -Wall
+CFLAGS		+= $(WARNINGS) $(DEFINES)
+
+export CC ECHO MAKE CFLAGS LIBS ARCH DEFINES
diff --git a/protobuf/Makefile b/protobuf/Makefile
index 901fbf8..ff869fb 100644
--- a/protobuf/Makefile
+++ b/protobuf/Makefile
@@ -1,21 +1,4 @@
--include ../Makefile.inc
-
-CFLAGS		+= -I./include
-CFLAGS		+= -O0 -ggdb3
-
-DEFINES		+= -D_FILE_OFFSET_BITS=64
-DEFINES		+= -D_GNU_SOURCE
-
-ifneq ($(WERROR),0)
-	WARNINGS += -Werror
-endif
-
-ifeq ($(DEBUG),1)
-	DEFINES += -DCR_DEBUG
-endif
-
-WARNINGS	+= -Wall
-CFLAGS		+= $(WARNINGS) $(DEFINES)
+include ../Makefile.inc
 
 LIBRARY		:= protobuf-lib.o
 
-- 
1.7.7.6



More information about the CRIU mailing list