expose an environment variable (IPKG_UPGRADE) to the scripts executed during a packag...
[openwrt/openwrt.git] / include / target.mk
index 8f072d0cd86de99bbc6bdca509a82d7fd6329cbd..757d178ab3937551244c6dd45e36b89dd8b98d3a 100644 (file)
@@ -1,4 +1,4 @@
-# 
+#
 # Copyright (C) 2007 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
@@ -12,9 +12,6 @@ endif
 ifneq ($(__target_inc),1)
 __target_inc=1
 
-TARGET_BUILD?=0
-
-
 target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
 ifeq ($(DUMP),)
   PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
@@ -26,15 +23,6 @@ endif
 TARGETID:=$(BOARD)$(if $(SUBTARGET),/$(SUBTARGET))
 PLATFORM_SUBDIR:=$(PLATFORM_DIR)$(if $(SUBTARGET),/$(SUBTARGET))
 
-define Target
-  KERNEL_TARGETS+=$(1)
-  ifeq ($(DUMP),1)
-    ifeq ($(SUBTARGET),)
-      BuildTarget=$$(BuildTargets/DumpAll)
-    endif
-  endif
-endef
-
 ifneq ($(TARGET_BUILD),1)
   include $(PLATFORM_DIR)/Makefile
   ifneq ($(PLATFORM_DIR),$(PLATFORM_SUBDIR))
@@ -75,9 +63,23 @@ define Profile
   endif
 endef
 
--include $(PLATFORM_DIR)/profiles/*.mk
 ifneq ($(PLATFORM_DIR),$(PLATFORM_SUBDIR))
-  -include $(PLATFORM_SUBDIR)/profiles/*.mk
+  define IncludeProfiles
+    -include $(PLATFORM_DIR)/profiles/*.mk
+    -include $(PLATFORM_SUBDIR)/profiles/*.mk
+  endef
+else
+  define IncludeProfiles
+    -include $(PLATFORM_DIR)/profiles/*.mk
+  endef
+endif
+
+ifeq ($(TARGET_BUILD),1)
+  $(eval $(call IncludeProfiles))
+else
+  ifeq ($(DUMP),)
+    $(eval $(call IncludeProfiles))
+  endif
 endif
 
 $(eval $(call shexport,Target/Description))
@@ -87,7 +89,7 @@ include $(INCLUDE_DIR)/kernel-version.mk
 GENERIC_PLATFORM_DIR := $(TOPDIR)/target/linux/generic-$(KERNEL)
 GENERIC_PATCH_DIR := $(GENERIC_PLATFORM_DIR)/patches$(shell [ -d "$(GENERIC_PLATFORM_DIR)/patches-$(KERNEL_PATCHVER)" ] && printf -- "-$(KERNEL_PATCHVER)" || true )
 
-GENERIC_LINUX_CONFIG:=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER) $(GENERIC_PLATFORM_DIR)/config-default))
+GENERIC_LINUX_CONFIG?=$(firstword $(wildcard $(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER) $(GENERIC_PLATFORM_DIR)/config-default))
 LINUX_CONFIG?=$(firstword $(wildcard $(foreach subdir,$(PLATFORM_DIR) $(PLATFORM_SUBDIR),$(subdir)/config-$(KERNEL_PATCHVER) $(subdir)/config-default)))
 LINUX_SUBCONFIG?=$(firstword $(wildcard $(PLATFORM_SUBDIR)/config-$(KERNEL_PATCHVER) $(PLATFORM_SUBDIR)/config-default))
 ifeq ($(LINUX_CONFIG),$(LINUX_SUBCONFIG))
@@ -115,27 +117,26 @@ ifeq ($(DUMP),1)
     ifneq ($(CONFIG_PCMCIA)$(CONFIG_PCCARD),)
       FEATURES += pcmcia
     endif
+    ifneq ($(CONFIG_VGA_CONSOLE)$(CONFIG_FB),)
+      FEATURES += display
+    endif
 
     # remove duplicates
     FEATURES:=$(sort $(FEATURES))
   endif
 endif
 
-define BuildTargets/DumpAll
-  dumpinfo:
-       @$(foreach SUBTARGET,$(KERNEL_TARGETS),$(SUBMAKE) -s DUMP=1 SUBTARGET=$(SUBTARGET); )
-endef
-
 define BuildTargets/DumpCurrent
-
+  .PHONY: dumpinfo
   dumpinfo:
        @echo 'Target: $(TARGETID)'; \
         echo 'Target-Board: $(BOARD)'; \
         echo 'Target-Kernel: $(KERNEL)'; \
-        echo 'Target-Name: $(BOARDNAME) [$(KERNEL)]'; \
+        echo 'Target-Name: $(BOARDNAME)$(if $(SUBTARGET),, [$(KERNEL)])'; \
         echo 'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'; \
         echo 'Target-Arch: $(ARCH)'; \
         echo 'Target-Features: $(FEATURES)'; \
+        echo 'Target-Depends: $(DEPENDS)'; \
         echo 'Linux-Version: $(LINUX_VERSION)'; \
         echo 'Linux-Release: $(LINUX_RELEASE)'; \
         echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'; \
@@ -144,6 +145,7 @@ define BuildTargets/DumpCurrent
         echo '@@'; \
         echo 'Default-Packages: $(DEFAULT_PACKAGES)'; \
         $(DUMPINFO)
+       $(if $(SUBTARGET),,@$(foreach SUBTARGET,$(SUBTARGETS),$(SUBMAKE) -s DUMP=1 SUBTARGET=$(SUBTARGET); ))
 endef
 
 include $(INCLUDE_DIR)/kernel.mk