From edc74f8cc3f810b03a39b5f98bd0c3908d5c9303 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Tue, 4 Dec 2007 03:04:37 +0000
Subject: [PATCH] fix make clean for unconfigured build trees

SVN-Revision: 9655
---
 Makefile            | 2 +-
 include/toplevel.mk | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index e56535eac4..970b0896ca 100644
--- a/Makefile
+++ b/Makefile
@@ -45,10 +45,10 @@ $(BUILD_DIR)/.prepared: Makefile
 clean: FORCE
 	rm -rf $(BUILD_DIR) $(BIN_DIR)
 	$(MAKE) target/linux/clean
-	rm -rf $(TMP_DIR)
 
 dirclean: clean
 	rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST)
+	rm -rf $(TMP_DIR)
 
 # check prerequisites before starting to build
 prereq: $(package/stamp-prereq) $(target/stamp-prereq) ;
diff --git a/include/toplevel.mk b/include/toplevel.mk
index 7930223650..040ff51249 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -98,7 +98,7 @@ download: .config FORCE
 	$(MAKE) -j1 package/download
 	$(MAKE) -j1 target/download
 
-clean dirclean:
+clean dirclean: .config
 	@$(MAKE) $@ 
 
 prereq:: .config
-- 
GitLab