Add an 'Image Configuration' menu to menuconfig
[openwrt.git] / include / package.mk
1 #
2 # Copyright (C) 2006,2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 all: $(if $(DUMP),dumpinfo,compile)
9
10 include $(INCLUDE_DIR)/prereq.mk
11 include $(INCLUDE_DIR)/host.mk
12 include $(INCLUDE_DIR)/unpack.mk
13 include $(INCLUDE_DIR)/package-defaults.mk
14 include $(INCLUDE_DIR)/package-dumpinfo.mk
15 include $(INCLUDE_DIR)/package-ipkg.mk
16
17 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
18
19 define Build/DefaultTargets
20 ifneq ($(strip $(PKG_SOURCE_URL)),)
21 download: $(DL_DIR)/$(PKG_SOURCE)
22
23 $(DL_DIR)/$(PKG_SOURCE):
24 mkdir -p $(DL_DIR)
25 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
26
27 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
28 endif
29
30 ifeq ($(DUMP),)
31 ifeq ($(CONFIG_AUTOREBUILD),y)
32 ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) . $(PKG_FILE_DEPEND)),$(PKG_BUILD_DIR))
33 $$(info Forcing package rebuild)
34 $(PKG_BUILD_DIR)/.prepared: clean
35 endif
36 endif
37 endif
38
39 $(PKG_BUILD_DIR)/.prepared:
40 @-rm -rf $(PKG_BUILD_DIR)
41 @mkdir -p $(PKG_BUILD_DIR)
42 $(Build/Prepare)
43 touch $$@
44
45 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
46 $(Build/Configure)
47 touch $$@
48
49 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
50 $(Build/Compile)
51 touch $$@
52
53 ifdef Build/InstallDev
54 ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg -x ipkg-install $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed $(PKG_BUILD_DIR)),$(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed)
55 $(PKG_BUILD_DIR)/.built: package-rebuild
56 endif
57
58 $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
59 mkdir -p $(STAGING_DIR)/stampfiles
60 $(Build/InstallDev)
61 touch $$@
62
63 compile: $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
64 endif
65
66 package-rebuild: FORCE
67 @-rm -f $(PKG_BUILD_DIR)/.built
68
69 define Build/DefaultTargets
70 endef
71 endef
72
73 define BuildPackage
74 $(eval $(Package/Default))
75 $(eval $(Package/$(1)))
76
77 # <HACK> Support obsolete DESCRIPTION field>
78 ifndef Package/$(1)/description
79 define Package/$(1)/description
80 $(TITLE)$(subst \,
81 ,\ $(DESCRIPTION))
82 endef
83 endif
84 # </HACK>
85
86 $(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION,
87 ifeq ($($(FIELD)),)
88 $$(error Package/$(1) is missing the $(FIELD) field)
89 endif
90 )
91
92 $(call shexport,Package/$(1)/description)
93 $(call shexport,Package/$(1)/config)
94
95 $(Dumpinfo)
96 $(BuildIPKG)
97 endef
98
99 define Build/Prepare
100 $(call Build/Prepare/Default,)
101 endef
102
103 define Build/Configure
104 $(call Build/Configure/Default,)
105 endef
106
107 define Build/Compile
108 $(call Build/Compile/Default,)
109 endef
110
111 $(PACKAGE_DIR):
112 mkdir -p $@
113
114 dumpinfo:
115 download:
116 prepare: $(PKG_BUILD_DIR)/.prepared
117 configure: $(PKG_BUILD_DIR)/.configured
118 compile:
119 install:
120 clean: FORCE
121 $(Build/UninstallDev)
122 @rm -f $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
123 @rm -rf $(PKG_BUILD_DIR)
This page took 0.047101 seconds and 5 git commands to generate.