1From 152486fa3c36c3b99d17d5b553cf87ef412fae8e Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Mon, 1 Dec 2014 01:53:41 +0900
4Subject: [PATCH] Makefile:modify CFLAGS to aviod build error.
5
6Upstream-Status: pending
7
8Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
9---
10 Makefile         | 22 +++++++++++-----------
11 plugins/Makefile |  6 +++---
12 2 files changed, 14 insertions(+), 14 deletions(-)
13
14diff --git a/Makefile b/Makefile
15index 4aaa448..baa7882 100644
16--- a/Makefile
17+++ b/Makefile
18@@ -152,10 +152,10 @@ LIBS.dmalloc=		-ldmalloc
19 export USE_DMALLOC
20 endif
21
22-CPPFLAGS=		$(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
23-CFLAGS=			-I. -Iusl -Icli -isystem include \
24-				-MMD -Wall -Werror -Wno-strict-aliasing \
25-				$(CPPFLAGS) $(CPPFLAGS.dmalloc) \
26+ADD_CPPFLAGS=		$(CPPFLAGS.l2tptest) $(CPPFLAGS-y)
27+ADD_CFLAGS=			-I. -Iusl -Icli -isystem include \
28+				-MMD -Wall -Wno-strict-aliasing \
29+				$(ADD_CPPFLAGS) $(CPPFLAGS.dmalloc) \
30 				-DSYS_LIBDIR=$(SYS_LIBDIR)
31 LDFLAGS.l2tpd=		-Wl,-E -L. -Lusl -lusl -ldl $(LIBS.dmalloc) -lc
32 LDFLAGS.l2tpconfig=	-Lcli -lcli -lreadline $(LIBS.dmalloc) $(READLINE_LDFLAGS) -lc
33@@ -170,10 +170,10 @@ CFLAGS.optimize=	$(OPT_CFLAGS)
34 endif
35 export CFLAGS.optimize
36
37-CFLAGS+=		$(CFLAGS.optimize)
38+ADD_CFLAGS+=		$(CFLAGS.optimize)
39
40 ifeq ($(L2TP_USE_ASYNC_RPC),y)
41-CPPFLAGS+=		-DL2TP_ASYNC_RPC
42+ADD_CPPFLAGS+=		-DL2TP_ASYNC_RPC
43 endif
44
45 ifeq ($(L2TP_FEATURE_RPC_MANAGEMENT),y)
46@@ -220,13 +220,13 @@ endif
47
48 # Compile without -Wall because rpcgen-generated code is full of warnings.
49 %_xdr.o:		%_xdr.c
50-			$(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
51+			$(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
52
53 %_client.o:		%_client.c
54-			$(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
55+			$(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
56
57 %_server.o:		%_server.c
58-			$(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(CPPFLAGS) $<
59+			$(CC) -I. -MMD -w $(CFLAGS.optimize) -c $(ADD_CPPFLAGS) $<
60
61 %_xdr.c:		%.x
62 			-$(RM) $@
63@@ -272,7 +272,7 @@ l2tpconfig:		$(L2TPCONFIG_SRCS.o)
64 			$(CC) -o $@ $^ $(LDFLAGS.l2tpconfig)
65
66 %.o:	%.c
67-			$(CC) -c $(CFLAGS) $< -o $@
68+			$(CC) -c $(CFLAGS) $(ADD_CFLAGS) $< -o $@
69
70 l2tp_options.h:	FORCE
71 	@rm -f $@.tmp
72@@ -325,7 +325,7 @@ install:		install-all
73 install-all:		all install-daemon install-app
74
75 install-daemon:
76-			@for d in $(filter-out usl,$(SUBDIRS)); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" install; if [ $$? -ne 0 ]; then exit 1; fi; done
77+			@for d in $(filter-out usl,$(SUBDIRS)); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS) $(ADD_CPPFLAGS)" install; if [ $$? -ne 0 ]; then exit 1; fi; done
78 			$(INSTALL) -d $(DESTDIR)/usr/sbin
79 			$(INSTALL) openl2tpd $(DESTDIR)/usr/sbin
80
81diff --git a/plugins/Makefile b/plugins/Makefile
82index 5be996d..6810236 100644
83--- a/plugins/Makefile
84+++ b/plugins/Makefile
85@@ -1,7 +1,7 @@
86-CFLAGS	:= $(CFLAGS.optimize) -MMD -Wall \
87+ADD_CFLAGS	:= $(CFLAGS.optimize) -MMD -Wall \
88 	-isystem ../include \
89 	-I. -I.. -I../usl -fPIC $(EXTRA_CFLAGS)
90-LDFLAGS	:= -shared
91+ADD_LDFLAGS	:= -shared
92
93 PLUGINS.c:=	ppp_unix.c ppp_null.c ipsec.c event_sock.c
94
95@@ -21,7 +21,7 @@ clean:
96 		$(RM) $(PLUGINS.so) $(wildcard *.o) $(wildcard *.d) $(SRC.generated)
97
98 %.so: %.c
99-		$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $<
100+		$(CC) -o $@ $(LDFLAGS) $(ADD_LDFLAGS) $(CFLAGS) $(ADD_CFLAGS) $<
101
102 install:	all
103 		$(INSTALL) -d $(DESTDIR)$(SYS_LIBDIR)/openl2tp
104--
1051.8.4.2
106
107