lantiq: Tune the XWAY subtarget cflags
[openwrt/staging/yousong.git] / package / mac80211 / patches / 001-fix_build.patch
1 --- a/Makefile
2 +++ b/Makefile
3 @@ -19,6 +19,7 @@ KLIB_BUILD ?= $(KLIB)/build/
4 KERNEL_CONFIG := $(KLIB_BUILD)/.config
5 KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
6 CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//')
7 +STAMP_KERNEL_CONFIG := .kernel_config_md5_$(CONFIG_MD5)
8
9 export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG
10
11 @@ -36,7 +37,8 @@ mrproper:
12 @rm -f .kernel_config_md5 Kconfig.versions Kconfig.kernel
13 @rm -f backport-include/backport/autoconf.h
14
15 -.DEFAULT:
16 +.SILENT: $(STAMP_KERNEL_CONFIG)
17 +$(STAMP_KERNEL_CONFIG):
18 @set -e ; test -f .local-symbols || ( \
19 echo "/--------------" ;\
20 echo "| You shouldn't run make in the backports tree, but only in" ;\
21 @@ -60,56 +62,60 @@ mrproper:
22 echo "| (that isn't currently running.)" ;\
23 echo "\\--" ;\
24 false)
25 - @set -e ; if [ "$$(cat .kernel_config_md5 2>/dev/null)" != "$(CONFIG_MD5)" ] ;\
26 - then \
27 - echo -n "Generating local configuration database from kernel ..." ;\
28 - grep -v -f .local-symbols $(KERNEL_CONFIG) | grep = | ( \
29 - while read l ; do \
30 - if [ "$${l:0:7}" != "CONFIG_" ] ; then \
31 - continue ;\
32 - fi ;\
33 - l=$${l:7} ;\
34 - n=$${l%%=*} ;\
35 - v=$${l#*=} ;\
36 - if [ "$$v" = "m" ] ; then \
37 - echo config $$n ;\
38 - echo ' tristate' ;\
39 - elif [ "$$v" = "y" ] ; then \
40 - echo config $$n ;\
41 - echo ' bool' ;\
42 - else \
43 - continue ;\
44 - fi ;\
45 - echo " default $$v" ;\
46 - echo "" ;\
47 - done \
48 - ) > Kconfig.kernel ;\
49 - kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
50 - sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
51 - test "$$kver" != "" || echo "Kernel version parse failed!" ;\
52 - test "$$kver" != "" ;\
53 - kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
54 - kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
55 - print=0 ;\
56 - for v in $$kvers ; do \
57 - if [ "$$print" = "1" ] ; then \
58 - echo config BACKPORT_KERNEL_$$(echo $$v | tr . _) ;\
59 - echo " def_bool y" ;\
60 - fi ;\
61 - if [ "$$v" = "$$kver" ] ; then print=1 ; fi ;\
62 - done > Kconfig.versions ;\
63 - # RHEL as well, sadly we need to grep for it ;\
64 - RHEL_MAJOR=$$(grep '^RHEL_MAJOR' $(KERNEL_MAKEFILE) | \
65 - sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
66 - RHEL_MINOR=$$(grep '^RHEL_MINOR' $(KERNEL_MAKEFILE) | \
67 - sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
68 - for v in $$(seq 0 $$RHEL_MINOR) ; do \
69 - echo config BACKPORT_RHEL_KERNEL_$${RHEL_MAJOR}_$$v ;\
70 - echo " def_bool y" ;\
71 - done >> Kconfig.versions ;\
72 - echo " done." ;\
73 - fi ;\
74 - echo "$(CONFIG_MD5)" > .kernel_config_md5
75 + @rm -f .kernel_config_md5_*
76 + @touch $@
77 +
78 +Kconfig.kernel: $(STAMP_KERNEL_CONFIG) .local-symbols
79 + @printf "Generating local configuration database from kernel ..."
80 + @grep -v -f .local-symbols $(KERNEL_CONFIG) | grep = | ( \
81 + while read l ; do \
82 + if [ "$${l:0:7}" != "CONFIG_" ] ; then \
83 + continue ;\
84 + fi ;\
85 + l=$${l:7} ;\
86 + n=$${l%%=*} ;\
87 + v=$${l#*=} ;\
88 + if [ "$$v" = "m" ] ; then \
89 + echo config $$n ;\
90 + echo ' tristate' ;\
91 + elif [ "$$v" = "y" ] ; then \
92 + echo config $$n ;\
93 + echo ' bool' ;\
94 + else \
95 + continue ;\
96 + fi ;\
97 + echo " default $$v" ;\
98 + echo "" ;\
99 + done \
100 + ) > $@
101 + @echo " done."
102 +
103 +Kconfig.versions: Kconfig.kernel
104 + @kver=$$($(MAKE) --no-print-directory -C $(KLIB_BUILD) kernelversion | \
105 + sed 's/^\(\(3\|2\.6\)\.[0-9]\+\).*/\1/;t;d') ;\
106 + test "$$kver" != "" || echo "Kernel version parse failed!" ;\
107 + test "$$kver" != "" ;\
108 + kvers="$$(seq 14 39 | sed 's/^/2.6./')" ;\
109 + kvers="$$kvers $$(seq 0 99 | sed 's/^/3./')" ;\
110 + print=0 ;\
111 + for v in $$kvers ; do \
112 + if [ "$$print" = "1" ] ; then \
113 + echo config BACKPORT_KERNEL_$$(echo $$v | tr . _) ;\
114 + echo " def_bool y" ;\
115 + fi ;\
116 + if [ "$$v" = "$$kver" ] ; then print=1 ; fi ;\
117 + done > $@
118 + @RHEL_MAJOR=$$(grep '^RHEL_MAJOR' $(KERNEL_MAKEFILE) | \
119 + sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
120 + RHEL_MINOR=$$(grep '^RHEL_MINOR' $(KERNEL_MAKEFILE) | \
121 + sed 's/.*=\s*\([0-9]*\)/\1/;t;d') ;\
122 + for v in $$(seq 0 $$RHEL_MINOR) ; do \
123 + echo config BACKPORT_RHEL_KERNEL_$${RHEL_MAJOR}_$$v ;\
124 + echo " def_bool y" ;\
125 + done >> $@
126 +
127 +.DEFAULT:
128 + @$(MAKE) Kconfig.versions
129 @$(MAKE) -f Makefile.real "$@"
130
131 else
132 --- a/Makefile.real
133 +++ b/Makefile.real
134 @@ -54,7 +54,7 @@ defconfig-%::
135
136 backport-include/backport/autoconf.h: .config Kconfig.versions Kconfig.kernel
137 @$(MAKE) oldconfig
138 - @echo -n "Building backport-include/backport/autoconf.h ..."
139 + @printf "Building backport-include/backport/autoconf.h ..."
140 @grep -f .local-symbols .config | ( \
141 echo "#ifndef COMPAT_AUTOCONF_INCLUDED" ;\
142 echo "#define COMPAT_AUTOCONF_INCLUDED" ;\
143 @@ -75,7 +75,12 @@ backport-include/backport/autoconf.h: .c
144 esac ;\
145 done ;\
146 echo "#endif /* COMPAT_AUTOCONF_INCLUDED */" ;\
147 - ) > backport-include/backport/autoconf.h
148 + ) > $@.new
149 + @if cmp -s $@ $@.new; then \
150 + rm -f $@.new; \
151 + else \
152 + mv $@.new $@; \
153 + fi
154 @echo " done."
155
156 .PHONY: modules