don't try to package ipt_SNAT and ipt_DNAT when making kernel module packages
[openwrt.git] / include / package.mk
index cf8756e..cd1a33c 100644 (file)
@@ -1,19 +1,25 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
 ifneq ($(DUMP),)
   all: dumpinfo
 else
   all: compile
 endif
 
 ifneq ($(DUMP),)
   all: dumpinfo
 else
   all: compile
 endif
 
+include $(INCLUDE_DIR)/prereq.mk
+
 define Build/DefaultTargets
   ifeq ($(DUMP),)
 define Build/DefaultTargets
   ifeq ($(DUMP),)
-    ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),$(PKG_BUILD_DIR))
-      ifeq ($(CONFIG_AUTOREBUILD),y)
+    ifeq ($(CONFIG_AUTOREBUILD),y)
+      ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) .),$(PKG_BUILD_DIR))
         $(PKG_BUILD_DIR)/.prepared: package-clean
       endif
         $(PKG_BUILD_DIR)/.prepared: package-clean
       endif
-    endif
 
 
-    ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg $(IPKG_$(1)) $(PKG_BUILD_DIR)),$(IPKG_$(1)))
-      ifeq ($(CONFIG_AUTOREBUILD),y)
+      ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg $(IPKG_$(1)) $(PKG_BUILD_DIR)),$(IPKG_$(1)))
         $(PKG_BUILD_DIR)/.built: package-rebuild
       endif
     endif
         $(PKG_BUILD_DIR)/.built: package-rebuild
       endif
     endif
@@ -35,6 +41,7 @@ define Build/DefaultTargets
        touch $$@
 
   $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
        touch $$@
 
   $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
+       mkdir -p $(STAGING_DIR)/stampfiles
        $(call Build/InstallDev)
        touch $$@
        
        $(call Build/InstallDev)
        touch $$@
        
@@ -59,6 +66,7 @@ define Package/Default
   SECTION:=opt
   CATEGORY:=Extra packages
   DEPENDS:=
   SECTION:=opt
   CATEGORY:=Extra packages
   DEPENDS:=
+  EXTRA_DEPENDS:=
   MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
   SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
   ifneq ($(PKG_VERSION),)
   MAINTAINER:=OpenWrt Developers Team <openwrt-devel@openwrt.org>
   SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd})
   ifneq ($(PKG_VERSION),)
@@ -74,6 +82,8 @@ define Package/Default
   PRIORITY:=optional
   DEFAULT:=
   MENU:=
   PRIORITY:=optional
   DEFAULT:=
   MENU:=
+  SUBMENU:=
+  SUBMENUDEP:=
   TITLE:=
   DESCRIPTION:=
 endef
   TITLE:=
   DESCRIPTION:=
 endef
@@ -106,12 +116,18 @@ define BuildPackage
   IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
   INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
 
   IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg/$(1)
   INFO_$(1):=$(IPKG_STATE_DIR)/info/$(1).list
 
-  ifeq ($(CONFIG_PACKAGE_$(1)),y)
-    install-targets: $$(INFO_$(1))
+  ifdef Package/$(1)/install
+    ifeq ($(CONFIG_PACKAGE_$(1)),y)
+      install-targets: $$(INFO_$(1))
+    endif
+
+    ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
+      compile-targets: $$(IPKG_$(1))
+    endif
   endif
 
   endif
 
-  ifneq ($(CONFIG_PACKAGE_$(1))$(DEVELOPER),)
-    compile-targets: $$(IPKG_$(1))
+  ifeq ($(FORCEREBUILD),y)
+    $$(IPKG_$(1)): FORCE
   endif
 
   IDEPEND_$(1):=$$(strip $$(DEPENDS))
   endif
 
   IDEPEND_$(1):=$$(strip $$(DEPENDS))
@@ -124,6 +140,15 @@ define BuildPackage
        echo "Menu: $(MENU)";
   endif
 
        echo "Menu: $(MENU)";
   endif
 
+  ifneq ($(SUBMENU),)
+    DUMPINFO += \
+       echo "Submenu: $(SUBMENU)";
+    ifneq ($(SUBMENUDEP),)
+      DUMPINFO += \
+         echo "Submenu-Depends: $(SUBMENUDEP)";
+    endif
+  endif
+
   ifneq ($(DEFAULT),)
     DUMPINFO += \
        echo "Default: $(DEFAULT)";
   ifneq ($(DEFAULT),)
     DUMPINFO += \
        echo "Default: $(DEFAULT)";
@@ -157,7 +182,7 @@ define BuildPackage
   $(eval $(call BuildIPKGVariable,$(1),postinst))
   $(eval $(call BuildIPKGVariable,$(1),prerm))
   $(eval $(call BuildIPKGVariable,$(1),postrm))
   $(eval $(call BuildIPKGVariable,$(1),postinst))
   $(eval $(call BuildIPKGVariable,$(1),prerm))
   $(eval $(call BuildIPKGVariable,$(1),postrm))
-  $$(IDIR_$(1))/CONTROL/control: $(PKG_BUILD_DIR)/.prepared
+  $$(IDIR_$(1))/CONTROL/control: Makefile $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH)
        mkdir -p $$(IDIR_$(1))/CONTROL
        echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
        echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
        mkdir -p $$(IDIR_$(1))/CONTROL
        echo "Package: $(1)" > $$(IDIR_$(1))/CONTROL/control
        echo "Version: $(VERSION)" >> $$(IDIR_$(1))/CONTROL/control
@@ -166,7 +191,7 @@ define BuildPackage
                for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
                        DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
                done; \
                for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \
                        DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \
                done; \
-               echo "Depends: $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \
+               echo "Depends: $(EXTRA_DEPENDS) $$$$DEPENDS" >> $$(IDIR_$(1))/CONTROL/control; \
        )
        echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control
        echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control
        )
        echo "Source: $(SOURCE)" >> $$(IDIR_$(1))/CONTROL/control
        echo "Section: $(SECTION)" >> $$(IDIR_$(1))/CONTROL/control
@@ -187,6 +212,7 @@ define BuildPackage
        -find $$(IDIR_$(1)) -name '.#*' | xargs rm -f
        $(RSTRIP) $$(IDIR_$(1))
        $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
        -find $$(IDIR_$(1)) -name '.#*' | xargs rm -f
        $(RSTRIP) $$(IDIR_$(1))
        $(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
+       @[ -f $$(IPKG_$(1)) ] || false 
 
   $$(INFO_$(1)): $$(IPKG_$(1))
        $(IPKG) install $$(IPKG_$(1))
 
   $$(INFO_$(1)): $$(IPKG_$(1))
        $(IPKG) install $$(IPKG_$(1))
@@ -196,6 +222,10 @@ define BuildPackage
 
   clean: $(1)-clean
 
 
   clean: $(1)-clean
 
+  $(PKG_BUILD_DIR)/.version-$(1)_$(VERSION)_$(PKGARCH): $(PKG_BUILD_DIR)/.prepared
+       -rm $(PKG_BUILD_DIR)/.version-$(1)_*
+       @touch $$@
+
   $$(eval $$(call Build/DefaultTargets,$(1)))
 
 endef
   $$(eval $$(call Build/DefaultTargets,$(1)))
 
 endef
@@ -274,7 +304,7 @@ else
        mkdir -p $@
                
   ifneq ($(strip $(PKG_SOURCE)),)
        mkdir -p $@
                
   ifneq ($(strip $(PKG_SOURCE)),)
-    source: $(DL_DIR)/$(PKG_SOURCE)
+    download: $(DL_DIR)/$(PKG_SOURCE)
 
     $(DL_DIR)/$(PKG_SOURCE):
                mkdir -p $(DL_DIR)
 
     $(DL_DIR)/$(PKG_SOURCE):
                mkdir -p $(DL_DIR)
@@ -283,7 +313,7 @@ else
     $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
   endif
 
     $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
   endif
 
-  source:
+  download:
   prepare: $(PKG_BUILD_DIR)/.prepared
   configure: $(PKG_BUILD_DIR)/.configured
 
   prepare: $(PKG_BUILD_DIR)/.prepared
   configure: $(PKG_BUILD_DIR)/.configured
 
This page took 0.024354 seconds and 4 git commands to generate.