build: ensure that flock is available for make download
[openwrt/openwrt.git] / include / toplevel.mk
index d8ea6cf..5fbf5e2 100644 (file)
@@ -107,7 +107,8 @@ scripts/config/conf:
        @$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf CC="$(HOSTCC_WRAPPER)"
 
 config: scripts/config/conf prepare-tmpinfo FORCE
-       $< Config.in
+       [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+               $< Config.in
 
 config-clean: FORCE
        $(_SINGLE)$(NO_TRACE_MAKE) -C scripts/config clean
@@ -115,7 +116,8 @@ config-clean: FORCE
 defconfig: scripts/config/conf prepare-tmpinfo FORCE
        touch .config
        @if [ ! -s .config -a -e $(HOME)/.openwrt/defconfig ]; then cp $(HOME)/.openwrt/defconfig .config; fi
-       $< --defconfig=.config Config.in
+       [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+               $< --defconfig=.config Config.in
 
 confdefault-y=allyes
 confdefault-m=allmod
@@ -123,13 +125,15 @@ confdefault-n=allno
 confdefault:=$(confdefault-$(CONFDEFAULT))
 
 oldconfig: scripts/config/conf prepare-tmpinfo FORCE
-       $< --$(if $(confdefault),$(confdefault),old)config Config.in
+       [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+               $< --$(if $(confdefault),$(confdefault),old)config Config.in
 
 menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
        if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
                cp $(HOME)/.openwrt/defconfig .config; \
        fi
-       [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; $< Config.in
+       [ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
+               $< Config.in
 
 prepare_kernel_conf: .config FORCE
 
@@ -172,7 +176,7 @@ else
   DOWNLOAD_DIRS = package/download
 endif
 
-download: .config FORCE
+download: .config FORCE $(if $(wildcard $(TOPDIR)/staging_dir/host/bin/flock),,tools/flock/compile)
        @+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);)
 
 clean dirclean: .config