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 ifeq ($(TARGET_BUILD
),1)
9 PKG_BUILD_DIR
:=$(LINUX_DIR
)
13 ifeq ($(MAKECMDGOALS
),refresh
)
18 @for patch in
$$$$( (cd
$(1) && if
[ -f series
]; then grep
-v
'^#' series
; else ls
; fi
; ) 2>/dev
/null
); do
( \
19 cp
"$(1)/$$$$patch" $(PKG_BUILD_DIR
); \
20 cd
$(PKG_BUILD_DIR
); \
21 quilt import
-P
$(2)$$$$patch -p
1 "$$$$patch"; \
22 quilt push
-f
>/dev
/null
2>/dev
/null
; \
27 QUILT?
=$(strip $(shell test -f
$(PKG_BUILD_DIR
)/.quilt_used
&& echo y
))
29 STAMP_PREPARED
:=$(strip $(STAMP_PREPARED
))_q
30 STAMP_PATCHED
:=$(PKG_BUILD_DIR
)/.quilt_patched
31 override CONFIG_AUTOREBUILD
=
32 define Build
/Patch
/Default
33 rm -rf
$(PKG_BUILD_DIR
)/patches
34 mkdir
-p
$(PKG_BUILD_DIR
)/patches
35 $(call Quilt
/Patch
,$(PATCH_DIR
),)
37 touch
$(PKG_BUILD_DIR
)/.quilt_used
39 $(STAMP_CONFIGURED
): $(STAMP_PATCHED
) FORCE
40 prepare
: $(STAMP_PATCHED
)
41 quilt-check
: $(STAMP_PATCHED
)
43 define Build
/Patch
/Default
44 @if
[ -d
$(PATCH_DIR
) -a
"$$$$(ls $(PATCH_DIR) | wc -l)" -gt
0 ]; then \
45 $(PATCH
) $(PKG_BUILD_DIR
) $(PATCH_DIR
); \
50 define Kernel
/Patch
/Default
51 if
[ -d
$(GENERIC_PLATFORM_DIR
)/files
]; then
$(CP
) $(GENERIC_PLATFORM_DIR
)/files
/* $(LINUX_DIR
)/; fi
52 if
[ -d .
/files
]; then
$(CP
) .
/files
/* $(LINUX_DIR
)/; fi
53 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(GENERIC_PATCH_DIR
),generic
/), \
54 if
[ -d
$(GENERIC_PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(GENERIC_PATCH_DIR
); fi \
56 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(PATCH_DIR
),platform
/), \
57 if
[ -d
$(PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(PATCH_DIR
); fi \
59 $(if
$(strip $(QUILT
)),touch
$(PKG_BUILD_DIR
)/.quilt_used
)
62 ifeq ($(TARGET_BUILD
),1)
63 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
64 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
66 cd
$(PKG_BUILD_DIR
)/patches
; \
69 if
[ -f
$$file/series
]; then \
70 echo
"Converting $$file/series"; \
71 awk
-v file
="$$file/" '$$0 !~ /^#/ { print file $$0 }' $$file/series
>> series
; \
73 echo
"Sorting patches in $$file"; \
74 find
$$file/* -type f \
! -name series |
sort >> series
; \
78 if
[ -s
"$(PKG_BUILD_DIR)/patches/series" ]; then
(cd
$(PKG_BUILD_DIR
); quilt push
-a
); fi
81 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
82 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
84 cd
$(PKG_BUILD_DIR
)/patches
; \
85 find
* -type f \
! -name series |
sort > series
; \
87 if
[ -s
"$(PKG_BUILD_DIR)/patches/series" ]; then
(cd
$(PKG_BUILD_DIR
); quilt push
-a
); fi
91 define Quilt
/RefreshDir
93 -rm -f
$(1)/* 2>/dev
/null
>/dev
/null
95 for patch in
$$($(if
$(2),grep
"^$(2)",cat
) $(PKG_BUILD_DIR
)/patches
/series | awk
'{print $$1}'); do \
96 $(CP
) -v
"$(PKG_BUILD_DIR)/patches/$$patch" $(1); \
101 define Quilt
/Refresh
/Package
102 $(call Quilt
/RefreshDir
,$(PATCH_DIR
))
105 define Quilt
/Refresh
/Kernel
106 @
[ -z
"$$(grep -v '^generic/' $(PKG_BUILD_DIR)/patches/series | grep -v '^platform/')" ] ||
{ \
107 echo
"All kernel patches must start with either generic/ or platform/"; \
110 $(call Quilt
/RefreshDir
,$(GENERIC_PATCH_DIR
),generic
/)
111 $(call Quilt
/RefreshDir
,$(PATCH_DIR
),platform
/)
114 quilt-check
: $(STAMP_PREPARED
) FORCE
115 @
[ -f
"$(PKG_BUILD_DIR)/.quilt_used" ] ||
{ \
116 echo
"The source directory was not unpacked using quilt. Please rebuild with QUILT=1"; \
119 @
[ -f
"$(PKG_BUILD_DIR)/patches/series" ] ||
{ \
120 echo
"The source directory contains no quilt patches."; \
123 @
[ "$$(cat $(PKG_BUILD_DIR)/patches/series | md5sum)" = "$$(sort $(PKG_BUILD_DIR)/patches/series | md5sum)" ] ||
{ \
124 echo
"The patches are not sorted in the right order. Please fix."; \
129 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null
130 @cd
$(PKG_BUILD_DIR
); while quilt next
2>/dev
/null
>/dev
/null
&& quilt push
; do \
132 done
; ! quilt next
2>/dev
/null
>/dev
/null
133 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
136 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
This page took 0.056329 seconds and 5 git commands to generate.