From c36fa4f1ee4f390f493901c15f0a9faeef6be2ef Mon Sep 17 00:00:00 2001 From: JDierkse Date: Mon, 24 Aug 2020 11:17:12 +0200 Subject: [PATCH] Alias Directories to prevent name clashes --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3afef56..2a41944 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ SUBDIRS := $(foreach dir,$(SUBDIRS),$(subst /.,,$(dir))) FILTER = crash% doc% include% lib% Libraries% Makefiles% SUBDIRS := $(filter-out $(FILTER),$(SUBDIRS)) SUBDIRARS = $(foreach dir,$(SUBDIRS),$(dir)/$(dir).a) +SUBDIRS := $(foreach dir,$(SUBDIRS),$(dir)_DIRECTORY) LOCALSOURCES = $(wildcard *.cpp *.cc) LOCALOBJECTS := $(LOCALSOURCES:.cpp=.o.$(ARCH)) @@ -192,15 +193,16 @@ $(ARNAME): $(SUBDIRS) $(LOCALOBJECTS) .PHONY: $(SUBDIRS) $(SUBDIRS): - @if [ -e "$@/Makefile" ]; then \ + $(eval DIR := $(subst _DIRECTORY,,$@)) + @if [ -e "$(DIR)/Makefile" ]; then \ depth=$(MAKELEVEL); \ while [ $${depth} -gt 0 ] ; do \ echo -n " "; \ depth=`expr $$depth - 1`; \ done; \ true; \ - echo " <$@>"; \ - if ($(MAKE) -s -S -C $@ artifacts $(ARCH)); then \ + echo " <$(DIR)>"; \ + if ($(MAKE) -s -S -C $(DIR) artifacts $(ARCH)); then \ :; \ else \ exit $$?; \ @@ -211,7 +213,7 @@ $(SUBDIRS): depth=`expr $$depth - 1`; \ done; \ true; \ - echo " "; \ + echo " "; \ fi # ---------- Clean Rules ---------- @@ -226,6 +228,7 @@ clean: true; \ else \ for dir in $(SUBDIRS); do \ + dir=$${dir%_DIRECTORY}; \ if [ -e "$$dir/Makefile" ]; then \ depth=$(MAKELEVEL); \ while [ $${depth} -gt 0 ] ; do \ @@ -259,6 +262,7 @@ cleandeps: true; \ else \ for dir in $(SUBDIRS); do \ + dir=$${dir%_DIRECTORY}; \ if [ -e "$$dir/Makefile" ]; then \ depth=$(MAKELEVEL); \ while [ $${depth} -gt 0 ] ; do \