toplevel: fix release name
[openwrt/openwrt.git] / include / package.mk
index 88ec3ef57f5f3aad2eb67700e7a1e72a00acb0f8..6538afe3e24fc73bf85f88b820aa4b67aa3a4abf 100644 (file)
@@ -14,7 +14,6 @@ PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
 PKG_MD5SUM ?= unknown
 PKG_BUILD_PARALLEL ?=
 PKG_USE_MIPS16 ?= 1
-PKG_CHECK_FORMAT_SECURITY ?= 0
 
 ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
   MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
@@ -34,10 +33,8 @@ ifdef CONFIG_USE_MIPS16
     TARGET_CFLAGS += -mips16 -minterlink-mips16
   endif
 endif
-ifeq ($(strip $(PKG_CHECK_FORMAT_SECURITY)),1)
-  TARGET_CFLAGS += -Wformat -Werror=format-security
-endif
 
+include $(INCLUDE_DIR)/hardening.mk
 include $(INCLUDE_DIR)/prereq.mk
 include $(INCLUDE_DIR)/host.mk
 include $(INCLUDE_DIR)/unpack.mk
@@ -60,12 +57,23 @@ ifneq ($(PREV_STAMP_PREPARED),)
 else
   STAMP_PREPARED=$(PKG_BUILD_DIR)/.prepared$(if $(QUILT)$(DUMP),,_$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),))$(call confvar,$(PKG_PREPARED_DEPENDS)))
 endif
-STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
+STAMP_CONFIGURED=$(PKG_BUILD_DIR)/.configured$(if $(DUMP),,_$(call confvar,$(PKG_CONFIG_DEPENDS)))
 STAMP_CONFIGURED_WILDCARD=$(patsubst %_$(call confvar,$(PKG_CONFIG_DEPENDS)),%_*,$(STAMP_CONFIGURED))
 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
-STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)_installed
+STAMP_INSTALLED:=$(STAGING_DIR)/stamp/.$(PKG_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),)_installed
 
 STAGING_FILES_LIST:=$(PKG_NAME)$(if $(BUILD_VARIANT),.$(BUILD_VARIANT),).list
+
+define CleanStaging
+       rm -f $(STAMP_INSTALLED)
+       @-(\
+               cd "$(STAGING_DIR)"; \
+               if [ -f packages/$(STAGING_FILES_LIST) ]; then \
+                       cat packages/$(STAGING_FILES_LIST) | xargs -r rm -f 2>/dev/null; \
+               fi; \
+       )
+endef
+
 ifneq ($(if $(CONFIG_SRC_TREE_OVERRIDE),$(wildcard ./git-src)),)
   USE_GIT_TREE:=1
   QUILT:=1
@@ -89,11 +97,11 @@ include $(INCLUDE_DIR)/package-bin.mk
 include $(INCLUDE_DIR)/autotools.mk
 
 override MAKEFLAGS=
-CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
+CONFIG_SITE:=$(INCLUDE_DIR)/site/$(ARCH)
 CUR_MAKEFILE:=$(filter-out Makefile,$(firstword $(MAKEFILE_LIST)))
 SUBMAKE:=$(NO_TRACE_MAKE) $(if $(CUR_MAKEFILE),-f $(CUR_MAKEFILE))
 PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig:$(STAGING_DIR)/usr/share/pkgconfig
-unexport QUIET
+unexport QUIET CONFIG_SITE
 
 ifeq ($(DUMP)$(filter prereq clean refresh update,$(MAKECMDGOALS)),)
   ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
@@ -164,6 +172,7 @@ define Build/DefaultTargets
 
   $(call Build/Exports,$(STAMP_CONFIGURED))
   $(STAMP_CONFIGURED): $(STAMP_PREPARED)
+       $(CleanStaging)
        $(foreach hook,$(Hooks/Configure/Pre),$(call $(hook))$(sep))
        $(Build/Configure)
        $(foreach hook,$(Hooks/Configure/Post),$(call $(hook))$(sep))
@@ -181,7 +190,6 @@ define Build/DefaultTargets
 
   $(STAMP_INSTALLED) : export PATH=$$(TARGET_PATH_PKG)
   $(STAMP_INSTALLED): $(STAMP_BUILT)
-       $(SUBMAKE) -j1 clean-staging
        rm -rf $(TMP_DIR)/stage-$(PKG_NAME)
        mkdir -p $(TMP_DIR)/stage-$(PKG_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages
        $(foreach hook,$(Hooks/InstallDev/Pre),\
@@ -249,9 +257,6 @@ endif
     endif
   )
 
-  $(call shexport,Package/$(1)/description)
-  $(call shexport,Package/$(1)/config)
-
   $(if $(DUMP), \
     $(Dumpinfo/Package), \
     $(foreach target, \
@@ -295,16 +300,9 @@ prepare:
 configure:
 compile: prepare-package-install
 install: compile
-clean-staging: FORCE
-       rm -f $(STAMP_INSTALLED)
-       @-(\
-               cd "$(STAGING_DIR)"; \
-               if [ -f packages/$(STAGING_FILES_LIST) ]; then \
-                       cat packages/$(STAGING_FILES_LIST) | xargs -r rm -f 2>/dev/null; \
-               fi; \
-       )
 
-clean: clean-staging FORCE
+clean: FORCE
+       $(CleanStaging)
        $(call Build/UninstallDev,$(STAGING_DIR),$(STAGING_DIR_HOST))
        $(Build/Clean)
        rm -f $(STAGING_DIR)/packages/$(STAGING_FILES_LIST) $(STAGING_DIR_HOST)/packages/$(STAGING_FILES_LIST)
@@ -312,6 +310,6 @@ clean: clean-staging FORCE
 
 dist:
        $(Build/Dist)
-   
+
 distcheck:
-       $(Build/DistCheck) 
+       $(Build/DistCheck)