From patchwork Sat May 23 16:38:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannu Nyman X-Patchwork-Id: 475913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E20571402CC for ; Sun, 24 May 2015 02:39:08 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5762228BD5D; Sat, 23 May 2015 18:37:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 62AA8280AE2 for ; Sat, 23 May 2015 18:37:30 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .iki. - helo: .filtteri6.pp.htv. - helo-domain: .htv.) FROM/MX_MATCHES_NOT_HELO(DOMAIN)=1; rate: -5.5 Received: from filtteri6.pp.htv.fi (filtteri6.pp.htv.fi [213.243.153.189]) by arrakis.dune.hu (Postfix) with ESMTP for ; Sat, 23 May 2015 18:37:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by filtteri6.pp.htv.fi (Postfix) with ESMTP id EEAC356F4B3 for ; Sat, 23 May 2015 19:38:51 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from smtp4.welho.com ([213.243.153.38]) by localhost (filtteri6.pp.htv.fi [213.243.153.189]) (amavisd-new, port 10024) with ESMTP id tM7umd3T+d97 for ; Sat, 23 May 2015 19:38:46 +0300 (EEST) Received: from [192.168.1.180] (87-92-23-160.bb.dnainternet.fi [87.92.23.160]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp4.welho.com (Postfix) with ESMTPS id C3A125BC017 for ; Sat, 23 May 2015 19:38:46 +0300 (EEST) From: Hannu Nyman To: OpenWrt Development List Message-ID: <5560AD13.7050907@iki.fi> Date: Sat, 23 May 2015 19:38:43 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Thunderbird/40.0a2 MIME-Version: 1.0 Subject: [OpenWrt-Devel] [PATCH] Makefile: move cleaning of staging_dir/target* to clean instead of dirclean X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Makefile: move the cleaning of staging_dir/target* from dirclean to clean Currently "make clean" only clears the build_dir/target*, but leaves staging_dir/target* intact. "make clean" should also clean the staging_dir/target* directories, as in the current situation some old packages or libraries may be linked into the firmware from staging_dir despite a "make clean". The patch reorganises clean / dirclean functionality so that * "make clean" also clears the staging_dir/target* in addition to build_dir/target*. * "make dirclean" clears toolchain and host(=tools) directories from both build_dir and staging_dir signed-off-by: Hannu Nyman --- This patch is continuation to r45736. ( https://dev.openwrt.org/changeset/45736 ) The behaviour, where "make clean" does not clear staging_dir/target* can leave into problems when some package version gets bumped and some filenames change etc. It is possible that duplicated binaries can be found in staging_dir despite the user having run "make clean". I have been burned by that in the past few months, but luckily both jow and arokh have pointed me to right direction. Below are the directory definitions clarifying the variables and also an example that shows how staging_dir/target* contains quite many files after a make clean. Directory definitions: https://dev.openwrt.org/browser/trunk/rules.mk BUILD_DIR_BASE:=$(TOPDIR)/build_dir BUILD_DIR:=$(BUILD_DIR_BASE)/$(TARGET_DIR_NAME) STAGING_DIR:=$(TOPDIR)/staging_dir/$(TARGET_DIR_NAME) STAGING_DIR_HOST:=$(TOPDIR)/staging_dir/host TOOLCHAIN_DIR:=$(TOPDIR)/staging_dir/$(TOOLCHAIN_DIR_NAME) BUILD_DIR_HOST:=$(BUILD_DIR_BASE)/host BUILD_DIR_TOOLCHAIN:=$(BUILD_DIR_BASE)/$(TOOLCHAIN_DIR_NAME) Example: ******** perus@vb1504:/Openwrt/trunk$ make clean make[1] clean perus@vb1504:/Openwrt/trunk$ ls build_dir/ host toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2 perus@vb1504:/Openwrt/trunk$ ls staging_dir/ host target-mips_34kc_uClibc-0.9.33.2 toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2 perus@vb1504:/Openwrt/trunk$ du -d1 staging_dir/target-mips_34kc_uClibc-0.9.33.2/ 1604 staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo 26432 staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr 4 staging_dir/target-mips_34kc_uClibc-0.9.33.2/include 180 staging_dir/target-mips_34kc_uClibc-0.9.33.2/packages 2396 staging_dir/target-mips_34kc_uClibc-0.9.33.2/host 4 staging_dir/target-mips_34kc_uClibc-0.9.33.2/bin 4 staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp 51688 staging_dir/target-mips_34kc_uClibc-0.9.33.2/root-ar71xx 4 staging_dir/target-mips_34kc_uClibc-0.9.33.2/lib 82320 staging_dir/target-mips_34kc_uClibc-0.9.33.2/ Index: Makefile =================================================================== --- Makefile (revision 45741) +++ Makefile (working copy) @@ -50,10 +50,10 @@ prepare: $(target/stamp-compile) clean: FORCE - rm -rf $(BUILD_DIR) $(BIN_DIR) $(BUILD_LOG_DIR) + rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(BUILD_LOG_DIR) dirclean: clean - rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN) + rm -rf $(STAGING_DIR_HOST) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN) rm -rf $(TMP_DIR) ifndef DUMP_TARGET_DB