From ce45460ecbb276aabb5f77b67079840ac6e0643c Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Wed, 7 Apr 2021 13:54:44 +0300 Subject: [PATCH] Makefile/mem_stats: only modules Makfiles are used Without specifying a depth, when building per-groups statistics, only modules' Makefiles should be used, not other whatever libs are in each module. This commit is needed because the wolfssl libs has its own Makefile, with its own NAME= variables declared, resulting in redundant (and unused) declarations. --- Makefile.defs | 4 ++-- Makefile.modules | 4 ++-- Makefile.rules | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.defs b/Makefile.defs index 96404813121..74c9aa3ba91 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -529,8 +529,8 @@ endif ifneq (,$(MEM_STATS_HDR)) EXPECTED_MD5=$(shell [ -f $(MEM_STATS_HDR) ] && tail -n 1 $(MEM_STATS_HDR) | awk '{print $$4}') -MODULES_MD5=$(shell find $(dir $(MEM_STATS_HDR))/../modules -name "[Mm]akefile" | \ - awk -F/ '{print $$(NF - 1)}' | sort | $(md5sum_cmd) | awk '{print $$1}') +MODULES_MD5=$(shell find $(dir $(MEM_STATS_HDR))/../modules -maxdepth 2 -name "[Mm]akefile" | \ + awk -F/ '{print $$(NF - 1)}' | sort -u | $(md5sum_cmd) | awk '{print $$1}') ifneq ($(EXPECTED_MD5),$(MODULES_MD5)) REGENERATE_MEM_STATS=remove-mem-stats endif diff --git a/Makefile.modules b/Makefile.modules index 2708db3e81c..b01d682ba15 100644 --- a/Makefile.modules +++ b/Makefile.modules @@ -42,8 +42,8 @@ else md5sum_cmd = md5sum endif EXPECTED_MD5=$(shell [ -f $(MEM_STATS_HDR) ] && tail -n 1 $(MEM_STATS_HDR) | awk '{print $$4}') -MODULES_MD5=$(shell find $(dir $(MEM_STATS_HDR))/../modules -name "[Mm]akefile" | \ - awk -F/ '{print $$(NF - 1)}' | sort | $(md5sum_cmd) | awk '{print $$1}') +MODULES_MD5=$(shell find $(dir $(MEM_STATS_HDR))/../modules -maxdepth 2 -name "[Mm]akefile" | \ + awk -F/ '{print $$(NF - 1)}' | sort -u | $(md5sum_cmd) | awk '{print $$1}') ifneq ($(EXPECTED_MD5),$(MODULES_MD5)) REGENERATE_MEM_STATS=remove-mem-stats endif diff --git a/Makefile.rules b/Makefile.rules index 4c95c4e9b25..83db9dbb2ce 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -68,8 +68,8 @@ Makefile.conf: Makefile.conf.template # no need to generate mem/mem_stats.c from anywhere else mem/mem_stats.c: mem/mem_stats.h - @find modules/ -name "[Mm]akefile" -exec grep "NAME\s*=" {} \; \ - | awk 'BEGIN { FS = "[=\\. ]"; \ + @find modules/ -maxdepth 2 -name "[Mm]akefile" -exec grep "NAME\s*=" {} \; \ + | sort -u | awk 'BEGIN { FS = "[=\\. ]"; \ print "/* This file is auto-generated by running \"make generate-mem-stats\" */"; \ print "/* You should NOT edit this file manually */"; \ print "#ifdef SHM_EXTRA_STATS"; \ @@ -82,8 +82,8 @@ remove-mem-stats: -@rm -f $(MEM_STATS_HDR) %mem_stats.h: $(REGENERATE_MEM_STATS) - @find $(dir $@)/../modules/ -name "[Mm]akefile" -exec grep "NAME\s*=" {} \; \ - | awk 'BEGIN { FS = "[=\\. ]"; \ + @find $(dir $@)/../modules/ -maxdepth 2 -name "[Mm]akefile" -exec grep "NAME\s*=" {} \; \ + | sort -u | awk 'BEGIN { FS = "[=\\. ]"; \ print "/* This file is auto-generated by running \"make generate-mem-stats\" */"; \ print "/* You should NOT edit this file manually */"; \ print "#ifdef SHM_EXTRA_STATS"; \