From: Ben Crocker <[email protected]>

Add dist-dump-variables and dist-check-variables for dynamically
deriving variables from Makefile.common and dumping or checking them.
At the moment, the dist-dump-variables and dist-check-variables are
identical, except in the name of the script generated.

Add a dist-clean-scripts target to clean up generated scripts.

Signed-off-by: Ben Crocker <[email protected]>
---
 redhat/Makefile | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/redhat/Makefile b/redhat/Makefile
index ee3702434e05..7ec891df01ac 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -166,7 +166,11 @@ dist-clean-rpmdirs:
                rm -rf $$i; \
        done;
 
-dist-clean: dist-clean-sources dist-clean-configs dist-clean-rpmdirs
+dist-clean-scripts:
+       @if [ -f dist-dump-variables.sh ]; then rm dist-dump-variables.sh; fi
+       @if [ -f dist-check-variables.sh ]; then rm dist-check-variables.sh; fi
+
+dist-clean: dist-clean-sources dist-clean-configs dist-clean-rpmdirs 
dist-clean-scripts
 
 dist-stub-key:
        @echo "Copying pre-generated keys";
@@ -382,6 +386,18 @@ dist-get-latest:
 dist-os-version:
        @echo "OSVERSION: $(RHEL_MAJOR).$(RHEL_MINOR)"
 
+.EXPORT_ALL_VARIABLES:
+.PHONY: dist-dump-variables
+dist-dump-variables:
+       grep "^[        ]*[a-zA-Z_][a-zA-Z_0-9]*[       ]*[:?]*=" 
$(REDHAT)/Makefile.common | sed -e 's/[       
]*\([a-zA-Z_][a-zA-Z_0-9]*\).*/echo "\1=$$\1"/' | sort | uniq > 
dist-dump-variables.sh
+       chmod +x $(REDHAT)/dist-dump-variables.sh
+       @$(REDHAT)/dist-dump-variables.sh
+
+dist-check-variables:
+       grep "^[        ]*[a-zA-Z_][a-zA-Z_0-9]*[       ]*[:?]*=" 
$(REDHAT)/Makefile.common | sed -e 's/[       
]*\([a-zA-Z_][a-zA-Z_0-9]*\).*/echo "\1=$$\1"/' | sort | uniq > 
dist-check-variables.sh
+       chmod +x $(REDHAT)/dist-check-variables.sh
+       @$(REDHAT)/dist-check-variables.sh
+
 dist-help:
        @echo  'Cleaning targets:'
        @echo  '  dist-clean          - Clean redhat/configs/ and redhat/rpm/ 
directories.'
-- 
GitLab
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]

Reply via email to