c156d3062dec056a27def7dd412222e54440db6a
2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 ifneq ($(__quilt_inc
),1)
11 ifeq ($(TARGET_BUILD
),1)
12 PKG_BUILD_DIR
:=$(LINUX_DIR
)
16 ifeq ($(MAKECMDGOALS
),refresh
)
21 @for patch in
$$$$( (cd
$(1) && if
[ -f series
]; then grep
-v
'^#' series
; else ls
; fi
; ) 2>/dev
/null
); do
( \
22 cp
"$(1)/$$$$patch" $(PKG_BUILD_DIR
); \
23 cd
$(PKG_BUILD_DIR
); \
24 quilt import
-P
$(2)$$$$patch -p
1 "$$$$patch"; \
25 quilt push
-f
>/dev
/null
2>/dev
/null
; \
30 QUILT?
=$(strip $(shell test -f
$(PKG_BUILD_DIR
)/.quilt_used
&& echo y
))
32 STAMP_PATCHED
:=$(PKG_BUILD_DIR
)/.quilt_patched
33 override CONFIG_AUTOREBUILD
=
34 define Build
/Patch
/Default
35 rm -rf
$(PKG_BUILD_DIR
)/patches
36 mkdir
-p
$(PKG_BUILD_DIR
)/patches
37 $(call Quilt
/Patch
,$(PATCH_DIR
),)
39 touch
$(PKG_BUILD_DIR
)/.quilt_used
41 $(STAMP_CONFIGURED
): $(STAMP_PATCHED
) FORCE
42 prepare
: $(STAMP_PATCHED
)
43 quilt-check
: $(STAMP_PATCHED
)
45 define Build
/Patch
/Default
46 @if
[ -d
$(PATCH_DIR
) -a
"$$$$(ls $(PATCH_DIR) | wc -l)" -gt
0 ]; then \
47 if
[ -f
$(PATCH_DIR
)/series
]; then \
48 grep
-vE
'^#' $(PATCH_DIR
)/series | xargs
-n1 \
49 $(PATCH
) $(PKG_BUILD_DIR
) $(PATCH_DIR
); \
51 $(PATCH
) $(PKG_BUILD_DIR
) $(PATCH_DIR
); \
57 define Kernel
/Patch
/Default
58 if
[ -d
$(GENERIC_PLATFORM_DIR
)/files
]; then
$(CP
) $(GENERIC_PLATFORM_DIR
)/files
/* $(LINUX_DIR
)/; fi
59 if
[ -d .
/files
]; then
$(CP
) .
/files
/* $(LINUX_DIR
)/; fi
60 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(GENERIC_PATCH_DIR
),generic
/), \
61 if
[ -d
$(GENERIC_PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(GENERIC_PATCH_DIR
); fi \
63 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(PATCH_DIR
),platform
/), \
64 if
[ -d
$(PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(PATCH_DIR
); fi \
66 $(if
$(strip $(QUILT
)),touch
$(PKG_BUILD_DIR
)/.quilt_used
)
69 ifeq ($(TARGET_BUILD
),1)
70 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
71 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
73 cd
$(PKG_BUILD_DIR
)/patches
; \
76 if
[ -f
$$file/series
]; then \
77 echo
"Converting $$file/series"; \
78 awk
-v file
="$$file/" '$$0 !~ /^#/ { print file $$0 }' $$file/series
>> series
; \
80 echo
"Sorting patches in $$file"; \
81 find
$$file/* -type f \
! -name series |
sort >> series
; \
85 if
[ -s
"$(PKG_BUILD_DIR)/patches/series" ]; then
(cd
$(PKG_BUILD_DIR
); quilt push
-a
); fi
88 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
89 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
91 cd
$(PKG_BUILD_DIR
)/patches
; \
92 find
* -type f \
! -name series |
sort > series
; \
94 if
[ -s
"$(PKG_BUILD_DIR)/patches/series" ]; then
(cd
$(PKG_BUILD_DIR
); quilt push
-a
); fi
98 define Quilt
/RefreshDir
100 -rm -f
$(1)/* 2>/dev
/null
>/dev
/null
102 for patch in
$$($(if
$(2),grep
"^$(2)",cat
) $(PKG_BUILD_DIR
)/patches
/series | awk
'{print $$1}'); do \
103 $(CP
) -v
"$(PKG_BUILD_DIR)/patches/$$patch" $(1); \
108 define Quilt
/Refresh
/Package
109 $(call Quilt
/RefreshDir
,$(PATCH_DIR
))
112 define Quilt
/Refresh
/Kernel
113 @
[ -z
"$$(grep -v '^generic/' $(PKG_BUILD_DIR)/patches/series | grep -v '^platform/')" ] ||
{ \
114 echo
"All kernel patches must start with either generic/ or platform/"; \
117 $(call Quilt
/RefreshDir
,$(GENERIC_PATCH_DIR
),generic
/)
118 $(call Quilt
/RefreshDir
,$(PATCH_DIR
),platform
/)
121 quilt-check
: $(STAMP_PREPARED
) FORCE
122 @
[ -f
"$(PKG_BUILD_DIR)/.quilt_used" ] ||
{ \
123 echo
"The source directory was not unpacked using quilt. Please rebuild with QUILT=1"; \
126 @
[ -f
"$(PKG_BUILD_DIR)/patches/series" ] ||
{ \
127 echo
"The source directory contains no quilt patches."; \
130 @
[ "$$(cat $(PKG_BUILD_DIR)/patches/series | md5sum)" = "$$(sort $(PKG_BUILD_DIR)/patches/series | md5sum)" ] ||
{ \
131 echo
"The patches are not sorted in the right order. Please fix."; \
136 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null
137 @cd
$(PKG_BUILD_DIR
); while quilt next
2>/dev
/null
>/dev
/null
&& quilt push
; do \
139 done
; ! quilt next
2>/dev
/null
>/dev
/null
140 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
143 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
This page took 0.039926 seconds and 3 git commands to generate.