quilt.mk源码
来源:互联网 发布:php图片$_get 编辑:程序博客网 时间:2024/06/06 05:07
#2 # Copyright (C) 2007-2009 OpenWrt.org3 #4 # This is free software, licensed under the GNU General Public License v2.5 # See /LICENSE for more information.6 7 ifneq ($(if $(DUMP),1,$(__quilt_inc)),1)8 __quilt_inc:=19 10 ifeq ($(TARGET_BUILD),1)11 PKG_BUILD_DIR:=$(LINUX_DIR)12 endif13 PATCH_DIR?=./patches14 FILES_DIR?=./files15 HOST_PATCH_DIR?=$(PATCH_DIR)16 HOST_FILES_DIR?=$(FILES_DIR)17 18 ifeq ($(MAKECMDGOALS),refresh)19 override QUILT=120 endif21 22 QUILT_CMD:=quilt --quiltrc=-23 24 define filter_series25 sed -e s,\\\#.*,, $(1) | grep -E \[a-zA-Z0-9\]26 endef27 28 define PatchDir/Quilt29 @mkdir -p "$(1)/patches$(if $(3),/$(patsubst %/,%,$(3)))"30 @if [ -s "$(2)/series" ]; then \31 mkdir -p "$(1)/patches/$(3)"; \32 cp "$(2)/series" "$(1)/patches/$(3)"; \33 fi34 @for patch in $$$$( (cd "$(2)" && if [ -f series ]; then $(call filter_series,series); else ls | sort; fi; ) 2>/dev/null ); do ( \35 cp "$(2)/$$$$patch" "$(1)/patches/$(3)"; \36 echo "$(3)$$$$patch" >> "$(1)/patches/series"; \37 ); done38 $(if $(3),@echo $(3) >> "$(1)/patches/.subdirs")39 endef40 41 define PatchDir/Default42 @if [ -d "$(2)" ] && [ "$$$$(ls $(2) | wc -l)" -gt 0 ]; then \43 export PATCH="$(PATCH)"; \44 if [ -s "$(2)/series" ]; then \45 $(call filter_series,$(2)/series) | xargs -n1 \46 $(KPATCH) "$(1)" "$(2)"; \47 else \48 $(KPATCH) "$(1)" "$(2)"; \49 fi; \50 fi51 endef52 53 define PatchDir54 $(call PatchDir/$(if $(strip $(QUILT)),Quilt,Default),$(strip $(1)),$(strip $(2)),$(strip $(3)))55 endef56 57 define HostPatchDir58 $(call PatchDir/$(if $(strip $(HOST_QUILT)),Quilt,Default),$(strip $(1)),$(strip $(2)),$(strip $(3)))59 endef60 61 ifneq ($(PKG_BUILD_DIR),)62 QUILT?=$(if $(wildcard $(PKG_BUILD_DIR)/.quilt_used),y)63 ifneq ($(QUILT),)64 STAMP_CHECKED:=$(PKG_BUILD_DIR)/.quilt_checked65 override CONFIG_AUTOREBUILD=66 quilt-check: $(STAMP_CHECKED)67 endif68 endif69 70 ifneq ($(HOST_BUILD_DIR),)71 HOST_QUILT?=$(if $(findstring command,$(origin QUILT)),$(QUILT),$(if $(wildcard $(HOST_BUILD_DIR)/.quilt_used),y))72 ifneq ($(HOST_QUILT),)73 HOST_STAMP_CHECKED:=$(HOST_BUILD_DIR)/.quilt_checked74 override CONFIG_AUTOREBUILD=75 host-quilt-check: $(HOST_STAMP_CHECKED)76 endif77 endif78 79 define Host/Patch/Default80 $(if $(HOST_QUILT),rm -rf $(HOST_BUILD_DIR)/patches; mkdir -p $(HOST_BUILD_DIR)/patches)81 $(call HostPatchDir,$(HOST_BUILD_DIR),$(HOST_PATCH_DIR),)82 $(if $(HOST_QUILT),touch $(HOST_BUILD_DIR)/.quilt_used)83 endef84 85 define Build/Patch/Default86 $(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches)87 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR),)88 $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)89 endef90 91 kernel_files=$(foreach fdir,$(GENERIC_FILES_DIR) $(FILES_DIR),$(fdir)/.)92 define Kernel/Patch/Default93 rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches94 $(if $(kernel_files),$(CP) $(kernel_files) $(LINUX_DIR)/)95 find $(LINUX_DIR)/ -name \*.rej -or -name \*.orig | $(XARGS) rm -f96 $(call PatchDir,$(PKG_BUILD_DIR),$(GENERIC_PATCH_DIR),generic/)97 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR),platform/)98 endef99 100 define Quilt/RefreshDir101 mkdir -p $(2)102 -rm -f $(2)/* 2>/dev/null >/dev/null103 @( \104 for patch in $$$$($(if $(3),grep "^$(3)",cat) $(1)/patches/series | awk '{print $$$$1}'); do \105 $(CP) -v "$(1)/patches/$$$$patch" $(2); \106 done; \107 )108 endef109 110 define Quilt/Refresh/Host111 $(call Quilt/RefreshDir,$(HOST_BUILD_DIR),$(PATCH_DIR))112 endef113 114 define Quilt/Refresh/Package115 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR))116 endef117 118 define Quilt/Refresh/Kernel119 @[ -z "$$(grep -v '^generic/' $(PKG_BUILD_DIR)/patches/series | grep -v '^platform/')" ] || { \120 echo "All kernel patches must start with either generic/ or platform/"; \121 false; \122 }123 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(GENERIC_PATCH_DIR),generic/)124 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR),platform/)125 endef126 127 define Quilt/Template128 $($(2)STAMP_CONFIGURED): $($(2)STAMP_CHECKED) FORCE129 $($(2)STAMP_CHECKED): $($(2)STAMP_PREPARED)130 if [ -s "$(1)/patches/series" ]; then \131 (cd "$(1)"; \132 if $(QUILT_CMD) next >/dev/null 2>&1; then \133 $(QUILT_CMD) push -a; \134 else \135 $(QUILT_CMD) top >/dev/null 2>&1; \136 fi \137 ); \138 fi139 touch "$$@"140 141 $(3)quilt-check: $($(2)STAMP_PREPARED) FORCE142 @[ -f "$(1)/.quilt_used" ] || { \143 echo "The source directory was not unpacked using quilt. Please rebuild with QUILT=1"; \144 false; \145 }146 @[ -f "$(1)/patches/series" ] || { \147 echo "The source directory contains no quilt patches."; \148 false; \149 }150 @[ -n "$$$$(ls $(1)/patches/series)" -o "$$$$(cat $(1)/patches/series | md5sum)" = "$$(sort $(1)/patches/series | md5sum)" ] || { \151 echo "The patches are not sorted in the right order. Please fix."; \152 false; \153 }154 155 $(3)refresh: $(3)quilt-check156 @cd "$(1)"; $(QUILT_CMD) pop -a -f >/dev/null 2>/dev/null157 @cd "$(1)"; while $(QUILT_CMD) next 2>/dev/null >/dev/null && $(QUILT_CMD) push; do \158 QUILT_DIFF_OPTS="-p" $(QUILT_CMD) refresh -p ab --no-index --no-timestamps; \159 done; ! $(QUILT_CMD) next 2>/dev/null >/dev/null160 $(Quilt/Refresh/$(4))161 162 $(3)update: $(3)quilt-check163 $(Quilt/Refresh/$(4))164 endef165 166 Build/Quilt=$(call Quilt/Template,$(PKG_BUILD_DIR),,,$(if $(TARGET_BUILD),Kernel,Package))167 Host/Quilt=$(call Quilt/Template,$(HOST_BUILD_DIR),HOST_,host-,Host)168 169 endif
0 0
- quilt.mk源码
- quilt
- quilt-cut
- quilt使用方法
- quilt用法
- JPEG源码Android编译之Android.mk
- 安卓源码分析(一)Andriod.mk
- Android.mk多级目录源码的编写
- U-Boot源码——config.mk
- android源码编译--mk文件详解
- Android.mk,安卓系统AOSP源码
- quilt 命令(转)
- quilt 使用积累
- quilt 的使用例子
- CentOS7安装quilt
- diff,patch和quilt
- Quilt Tutorial,修改源代码树,使用quilt重新编译
- linux的补丁管理工具--quilt
- 在iOS9中突破微信App跳转的限制
- Android5.0特性3--水波纹
- Visual Studio 使用 Web Deploy 测试记录
- json格式数据的请求处理
- Guava学习笔记:Optional优雅的使用null
- quilt.mk源码
- Leetcode之Minimum Size Subarray Sum
- hive 表注释乱码以及show create table语句描述乱码解决
- 精准的金额类
- .net大文件上传报错问题,可以通过设置iis的文件大小和config的大小
- 动态链接库DLL和静态链接库
- android消息循环
- HDU 2011 多项式求和
- linuxshell 系列 sed 命令基本用法