JDierkse 6 anni fa
parent
commit
9866174ac2
5 ha cambiato i file con 92 aggiunte e 28 eliminazioni
  1. 85 24
      Makefile
  2. 1 0
      Makefile.conf.armv6
  3. 1 0
      Makefile.conf.armv8
  4. 1 0
      Makefile.conf.x86-64
  5. 4 4
      Makefile.target

+ 85 - 24
Makefile

@@ -4,7 +4,11 @@
 
 include Makefile.conf
 
-ARNAME        = $(notdir $(CURDIR)).a
+PID          := $(shell echo $$$$)
+PREFIX        = nice -n 19 /usr/bin/time --format='%E (%U)' -o /dev/shm/t-$(PID)
+POSTFIX       = && cat /dev/shm/t-$(PID) | xargs -I "%" echo -en '\033[100D\033[60C$1' "%\n" && rm -f /dev/shm/t-$(PID)
+
+ARNAME        = $(notdir $(CURDIR)).$(ARCH).a
 
 SUBDIRS      := $(wildcard */.)
 SUBDIRS      := $(foreach dir,$(SUBDIRS),$(subst /.,,$(dir)))
@@ -13,14 +17,15 @@ SUBDIRS      := $(filter-out $(FILTER),$(SUBDIRS))
 SUBDIRARS     = $(foreach dir,$(SUBDIRS),$(dir)/$(dir).a)
 
 LOCALSOURCES  = $(wildcard *.cpp *.cc)
-LOCALOBJECTS := $(LOCALSOURCES:.cpp=.o)
-LOCALOBJECTS := $(LOCALOBJECTS:.cc=.o)
+LOCALOBJECTS := $(LOCALSOURCES:.cpp=.$(ARCH).o)
+LOCALOBJECTS := $(LOCALOBJECTS:.cc=.$(ARCH).o)
 LOCALDEPENDS  = $(LOCALOBJECTS:.o=.d)
 SOURCES       = $(wildcard *.cpp */*.cpp */*/*.cpp */*/*/*.cpp)
-OBJECTS       = $(SOURCES:.cpp=.o)
+OBJECTS       = $(SOURCES:.cpp=.$(ARCH).o)
 DEPENDS       = $(OBJECTS:.o=.d)
 TARGETS       =
 
+
 $(LOCALOBJECTS): | $(SUBDIRS)
 $(OBJECTS): | $(SUBDIRS)
 
@@ -34,29 +39,73 @@ ifneq ($(MAKECMDGOALS),clean)
 -include $(LOCALDEPENDS)
 endif
 
-%.d: %.cpp
-	$(info [MM] $@)
-	@$(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
-
-%.o: %.cpp
-	$(info [CC] $@)
-	@nice -n 19 $(CC) -c $(CFLAGS) $< -o $@
-
-%.d: %.cc
-	$(info [MM] $@)
-	@$(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
-
-%.o: %.cc
-	$(info [CC] $@)
-	@nice -n 19 $(CC) -c $(CFLAGS) $< -o $@
+%.$(ARCH).d: %.cpp
+	@depth=$(MAKELEVEL); \
+	while [ $${depth} -gt 0 ] ; do \
+		echo -n " "; \
+		depth=`expr $$depth - 1`; \
+	done; \
+	true
+	@echo -n " [MM] $@"
+	@$(PREFIX) $(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ $(POSTFIX)
+
+%.$(ARCH).o: %.cpp
+	@depth=$(MAKELEVEL); \
+	while [ $${depth} -gt 0 ] ; do \
+		echo -n " "; \
+		depth=`expr $$depth - 1`; \
+	done; \
+	true
+	@echo -n " [CC] $@"
+	@$(PREFIX) $(CC) -c $(CFLAGS) $< -o $@ $(POSTFIX)
+
+%.$(ARCH).d: %.cc
+	@depth=$(MAKELEVEL); \
+	while [ $${depth} -gt 0 ] ; do \
+		echo -n " "; \
+		depth=`expr $$depth - 1`; \
+	done; \
+	true
+	@echo -n " [MM] $@"
+	@$(PREFIX) $(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ $(POSTFIX)
+
+%.$(ARCH).o: %.cc
+	@depth=$(MAKELEVEL); \
+	while [ $${depth} -gt 0 ] ; do \
+		echo -n " "; \
+		depth=`expr $$depth - 1`; \
+	done; \
+	true
+	@echo -n " [CC] $@"
+	@$(PREFIX) $(CC) -c $(CFLAGS) $< -o $@ $(POSTFIX)
 
 $(ARNAME): $(SUBDIRS) $(LOCALOBJECTS)
-	$(info [AR] $@)
-	@nice -n 19 $(AR) rcuT $@ $(LOCALOBJECTS) $(SUBDIRARS)
+	@depth=$(MAKELEVEL); \
+	while [ $${depth} -gt 0 ] ; do \
+		echo -n " "; \
+		depth=`expr $$depth - 1`; \
+	done; \
+	true
+	@echo -n " [AR] $@"
+	@$(PREFIX) $(AR) rcuT $@ $(LOCALOBJECTS) $(SUBDIRARS) $(POSTFIX)
 
 .PHONY: $(SUBDIRS)
 $(SUBDIRS):
-	@$(MAKE) -S -C $@ artifacts
+	@depth=$(MAKELEVEL); \
+	while [ $${depth} -gt 0 ] ; do \
+		echo -n " "; \
+		depth=`expr $$depth - 1`; \
+	done; \
+	true
+	@echo " <$@>"
+	@$(MAKE) -s -S -C $@ artifacts
+	@depth=$(MAKELEVEL); \
+	while [ $${depth} -gt 0 ] ; do \
+		echo -n " "; \
+		depth=`expr $$depth - 1`; \
+	done; \
+	true
+	@echo " </$@>"
 
 .PHONY: all
 all: $(TARGETS)
@@ -64,6 +113,18 @@ all: $(TARGETS)
 .PHONY: clean
 clean:
 	@for dir in $(SUBDIRS); do \
-		$(MAKE) -S -C $$dir $@; \
-	done
+		depth=$(MAKELEVEL); \
+		while [ $${depth} -gt 0 ] ; do \
+			echo -n " "; \
+			depth=`expr $$depth - 1`; \
+		done; \
+		echo " <$$dir>"; \
+		$(MAKE) -s -S -C $$dir $@; \
+		while [ $${depth} -gt 0 ] ; do \
+			echo -n " "; \
+			depth=`expr $$depth - 1`; \
+		done; \
+		echo " </$$dir>"; \
+	done; \
+	true
 	@rm -f $(LOCALOBJECTS) $(LOCALDEPENDS) $(ARNAME) $(TARGETS) || true

+ 1 - 0
Makefile.conf.armv6

@@ -2,6 +2,7 @@
 # Makefile.conf
 #
 
+ARCH := armv6
 CFLAGS := -g3 -O3 -fPIC -marm -march=armv6 -std=c++11
 CFLAGS += -Wall -Wextra -Wstrict-aliasing -fmax-errors=5 -Werror -Wunreachable-code -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wnoexcept -Woverloaded-virtual -Wsign-promo -Wstrict-null-sentinel -Wswitch-default -Wno-unused -Wno-variadic-macros -Wno-parentheses -Wno-unused-parameter -fdiagnostics-show-option
 # CFLAGS += -Wold-style-cast -Wundef -Wshadow -Wctor-dtor-privacy -Wredundant-decls -Wstrict-overflow=5 -Wcast-align

+ 1 - 0
Makefile.conf.armv8

@@ -2,6 +2,7 @@
 # Makefile.conf
 #
 
+ARCH := armv8
 CFLAGS := -g3 -O3 -fPIC -marm -march=armv8-a -std=c++11
 CFLAGS += -Wall -Wextra -Wstrict-aliasing -fmax-errors=5 -Werror -Wunreachable-code -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wnoexcept -Woverloaded-virtual -Wsign-promo -Wstrict-null-sentinel -Wswitch-default -Wno-unused -Wno-variadic-macros -Wno-parentheses -Wno-unused-parameter -Wno-missing-field-initializers -fdiagnostics-show-option
 # CFLAGS += -Wold-style-cast -Wundef -Wshadow -Wctor-dtor-privacy -Wredundant-decls -Wstrict-overflow=5 -Wcast-align

+ 1 - 0
Makefile.conf.x86-64

@@ -2,6 +2,7 @@
 # Makefile.conf.local
 #
 
+ARCH := x86-64
 CFLAGS := -g3 -O3 -Wall -fPIC -std=c++11
 CFLAGS += -Wall -Wextra -Wstrict-aliasing -pedantic -fmax-errors=5 -Werror -Wunreachable-code -Wcast-qual -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wnoexcept -Woverloaded-virtual -Wsign-promo -Wstrict-null-sentinel -Wswitch-default -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option
 # CFLAGS += -Wold-style-cast -Wundef -Wshadow -Wctor-dtor-privacy -Wredundant-decls -Wstrict-overflow=5 -Wcast-align

+ 4 - 4
Makefile.target

@@ -2,18 +2,18 @@
 # Makefile.target
 #
 
-PresenceDetection: Application/PresenceDetection.o $(OBJECTS)
+PresenceDetection: Application/PresenceDetection.$(ARCH).o $(OBJECTS)
 	$(eval $@_DATETIME := $(DATETIME))
 	@echo [LD] $@
-	@$(CC) -o $@ $^ $(LFLAGS) $(CFLAGS)
+	@$(PREFIX) $(CC) -o $@ $^ $(LFLAGS) $(CFLAGS) $(POSTFIX)
 	@$(OBJCOPY) --only-keep-debug $@ $(DEBUGDIR)/$@-$($@_DATETIME).debug
 	@$(STRIP) $(SFLAGS) $@
 	@$(OBJCOPY) --add-gnu-debuglink="$(DEBUGDIR)/$@-$($@_DATETIME).debug" $@
 	@chmod -x $(DEBUGDIR)/$@-$($@_DATETIME).debug
 
-test: Application/Test.o $(OBJECTS)
+test: Application/Test.$(ARCH).o $(OBJECTS)
 	@echo [LD] $@
-	@$(CC) -o $@ $^ $(LFLAGS) $(CFLAGS)
+	@$(PREFIX) $(CC) -o $@ $^ $(LFLAGS) $(CFLAGS) $(POSTFIX)
 	@$(STRIP) $(SFLAGS) $@
 
 .DEFAULT_GOAL := PresenceDetection