Skip to content

Commit

Permalink
Makefile/mem_stats: only modules Makfiles are used
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
razvancrainea committed Apr 7, 2021
1 parent 197dd6a commit ce45460
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Makefile.defs
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Makefile.modules
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Makefile.rules
Expand Up @@ -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"; \
Expand All @@ -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"; \
Expand Down

0 comments on commit ce45460

Please sign in to comment.