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_PATCHED
:=$(PKG_BUILD_DIR
)/.quilt_patched
30 override CONFIG_AUTOREBUILD
=
31 define Build
/Patch
/Default
32 rm -rf
$(PKG_BUILD_DIR
)/patches
33 mkdir
-p
$(PKG_BUILD_DIR
)/patches
34 $(call Quilt
/Patch
,$(PATCH_DIR
),)
36 touch
$(PKG_BUILD_DIR
)/.quilt_used
38 $(STAMP_CONFIGURED
): $(STAMP_PATCHED
) FORCE
39 prepare
: $(STAMP_PATCHED
)
40 quilt-check
: $(STAMP_PATCHED
)
42 define Build
/Patch
/Default
43 @if
[ -d
$(PATCH_DIR
) -a
"$$$$(ls $(PATCH_DIR) | wc -l)" -gt
0 ]; then \
44 $(PATCH
) $(PKG_BUILD_DIR
) $(PATCH_DIR
); \
49 define Kernel
/Patch
/Default
50 if
[ -d
$(GENERIC_PLATFORM_DIR
)/files
]; then
$(CP
) $(GENERIC_PLATFORM_DIR
)/files
/* $(LINUX_DIR
)/; fi
51 if
[ -d .
/files
]; then
$(CP
) .
/files
/* $(LINUX_DIR
)/; fi
52 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(GENERIC_PATCH_DIR
),generic
/), \
53 if
[ -d
$(GENERIC_PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(GENERIC_PATCH_DIR
); fi \
55 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(PATCH_DIR
),platform
/), \
56 if
[ -d
$(PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(PATCH_DIR
); fi \
58 $(if
$(strip $(QUILT
)),touch
$(PKG_BUILD_DIR
)/.quilt_used
)
61 ifeq ($(TARGET_BUILD
),1)
62 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
63 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
65 cd
$(PKG_BUILD_DIR
)/patches
; \
68 if
[ -f
$$file/series
]; then \
69 echo
"Converting $$file/series"; \
70 awk
-v file
="$$file/" '$$0 !~ /^#/ { print file $$0 }' $$file/series
>> series
; \
72 echo
"Sorting patches in $$file"; \
73 find
$$file/* -type f \
! -name series |
sort >> series
; \
77 if
[ -s
"$(PKG_BUILD_DIR)/patches/series" ]; then
(cd
$(PKG_BUILD_DIR
); quilt push
-a
); fi
80 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
81 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
83 cd
$(PKG_BUILD_DIR
)/patches
; \
84 find
* -type f \
! -name series |
sort > series
; \
86 if
[ -s
"$(PKG_BUILD_DIR)/patches/series" ]; then
(cd
$(PKG_BUILD_DIR
); quilt push
-a
); fi
90 define Quilt
/RefreshDir
92 -rm -f
$(1)/* 2>/dev
/null
>/dev
/null
94 for patch in
$$($(if
$(2),grep
"^$(2)",cat
) $(PKG_BUILD_DIR
)/patches
/series | awk
'{print $$1}'); do \
95 $(CP
) -v
"$(PKG_BUILD_DIR)/patches/$$patch" $(1); \
100 define Quilt
/Refresh
/Package
101 $(call Quilt
/RefreshDir
,$(PATCH_DIR
))
104 define Quilt
/Refresh
/Kernel
105 @
[ -z
"$$(grep -v '^generic/' $(PKG_BUILD_DIR)/patches/series | grep -v '^platform/')" ] ||
{ \
106 echo
"All kernel patches must start with either generic/ or platform/"; \
109 $(call Quilt
/RefreshDir
,$(GENERIC_PATCH_DIR
),generic
/)
110 $(call Quilt
/RefreshDir
,$(PATCH_DIR
),platform
/)
113 quilt-check
: $(STAMP_PREPARED
) FORCE
114 @
[ -f
"$(PKG_BUILD_DIR)/.quilt_used" ] ||
{ \
115 echo
"The source directory was not unpacked using quilt. Please rebuild with QUILT=1"; \
118 @
[ -f
"$(PKG_BUILD_DIR)/patches/series" ] ||
{ \
119 echo
"The source directory contains no quilt patches."; \
122 @
[ "$$(cat $(PKG_BUILD_DIR)/patches/series | md5sum)" = "$$(sort $(PKG_BUILD_DIR)/patches/series | md5sum)" ] ||
{ \
123 echo
"The patches are not sorted in the right order. Please fix."; \
128 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null
129 @cd
$(PKG_BUILD_DIR
); while quilt next
2>/dev
/null
>/dev
/null
&& quilt push
; do \
131 done
; ! quilt next
2>/dev
/null
>/dev
/null
132 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
135 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
This page took 0.044158 seconds and 5 git commands to generate.