Update Makefiles
This commit is contained in:
@@ -6,15 +6,20 @@ ROOTPATH := /opt/build/PresenceDetection
|
||||
COMMANDLINE := $(shell ps -o args= $$PPID)
|
||||
|
||||
ARCHS := $(shell ls $(ROOTPATH)/Makefile.conf.* | grep -v base | sed 's/.*Makefile\.conf\.//g')
|
||||
ARCHS += any
|
||||
ARCH := $(filter $(ARCHS),$(MAKECMDGOALS))
|
||||
MAKECMDGOALS := $(filter-out $(ARCH),$(MAKECMDGOALS))
|
||||
ARCHS := $(filter-out any,$(ARCHS))
|
||||
|
||||
ifeq ($(ARCH),)
|
||||
ARCH := x86-64
|
||||
endif
|
||||
|
||||
ifeq (,$(findstring -S,$(COMMANDLINE)))
|
||||
ifneq ($(ARCH),)
|
||||
$(info ARCH: $(ARCH))
|
||||
endif
|
||||
endif
|
||||
|
||||
-include $(ROOTPATH)/Makefile.conf.$(ARCH)
|
||||
-include $(ROOTPATH)/Makefile.conf.base
|
||||
@@ -44,7 +49,7 @@ OBJECTS = $(SOURCES:.cpp=.o.$(ARCH))
|
||||
DEPENDS = $(OBJECTS:.o.$(ARCH)=.d.$(ARCH))
|
||||
TARGETS =
|
||||
|
||||
define target
|
||||
define build_target_arch
|
||||
$(eval $@_DATETIME := $(DATETIME))
|
||||
@echo -n " [LD] $(1)\n"
|
||||
@$(PREFIX) $(CC) -o $(1) $(2) $(LFLAGS) $(CFLAGS) $(POSTFIX)
|
||||
@@ -54,6 +59,18 @@ define target
|
||||
@chmod -x $(DEBUGDIR)/$(1)-$($@_DATETIME).debug
|
||||
endef
|
||||
|
||||
define build_target
|
||||
@if [ "$(ARCH)" = "any" ]; then \
|
||||
for arch in $(ARCHS); do \
|
||||
echo "ARCH: $$arch"; \
|
||||
$(MAKE) -s -S $(1) $$arch; \
|
||||
done; \
|
||||
true; \
|
||||
else \
|
||||
$(MAKE) -s -S $(1).$(ARCH) $(ARCH); \
|
||||
fi
|
||||
endef
|
||||
|
||||
$(LOCALOBJECTS): | $(SUBDIRS)
|
||||
$(OBJECTS): | $(SUBDIRS)
|
||||
|
||||
@@ -68,14 +85,16 @@ ifneq ($(MAKECMDGOALS),clean)
|
||||
endif
|
||||
|
||||
%.d.$(ARCH): %.cpp
|
||||
@depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
true
|
||||
@echo -n " [MM] $@\n"
|
||||
@$(PREFIX) $(CC) $(CFLAGS) $< -MM -MT $(@:.d.$(ARCH)=.o.$(ARCH)) >$@ $(POSTFIX)
|
||||
@if [ "$(ARCH)" != "any" ]; then \
|
||||
depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
true; \
|
||||
echo -n " [MM] $@\n"; \
|
||||
$(PREFIX) $(CC) $(CFLAGS) $< -MM -MT $(@:.d.$(ARCH)=.o.$(ARCH)) >$@ $(POSTFIX); \
|
||||
fi
|
||||
|
||||
%.o.$(ARCH): %.cpp
|
||||
@depth=$(MAKELEVEL); \
|
||||
@@ -88,14 +107,16 @@ endif
|
||||
@$(PREFIX) $(CC) -c $(CFLAGS) $< -o $@ $(POSTFIX)
|
||||
|
||||
%.d.$(ARCH): %.cc
|
||||
@depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
true
|
||||
@echo -n " [MM] $@\n"
|
||||
@$(PREFIX) $(CC) $(CFLAGS) $< -MM -MT $(@:.d.$(ARCH)=.o.$(ARCH)) >$@ $(POSTFIX)
|
||||
@if [ "$(ARCH)" != "any" ]; then \
|
||||
depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
true; \
|
||||
echo -n " [MM] $@\n"; \
|
||||
$(PREFIX) $(CC) $(CFLAGS) $< -MM -MT $(@:.d.$(ARCH)=.o.$(ARCH)) >$@ $(POSTFIX); \
|
||||
fi
|
||||
|
||||
%.o.$(ARCH): %.cc
|
||||
@depth=$(MAKELEVEL); \
|
||||
@@ -140,64 +161,74 @@ all: $(TARGETS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@for dir in $(SUBDIRS); do \
|
||||
depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
@if [ "$(ARCH)" = "any" ]; then \
|
||||
for arch in $(ARCHS); do \
|
||||
echo "ARCH: $$arch"; \
|
||||
$(MAKE) -s -S $(MAKECMDGOALS) $$arch; \
|
||||
done; \
|
||||
echo " <$$dir>"; \
|
||||
$(MAKE) -s -S -C $$dir $@ $(ARCH); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
true; \
|
||||
else \
|
||||
for dir in $(SUBDIRS); do \
|
||||
depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
echo " <$$dir>"; \
|
||||
$(MAKE) -s -S -C $$dir $@ $(ARCH); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
echo " </$$dir>"; \
|
||||
done; \
|
||||
echo " </$$dir>"; \
|
||||
done; \
|
||||
true
|
||||
@rm -f $(LOCALOBJECTS) $(LOCALDEPENDS) $(ARNAME) $(TARGETS) || true
|
||||
for target in $(TARGETS); do \
|
||||
rm -f $$target.$(ARCH); \
|
||||
done; \
|
||||
true; \
|
||||
fi
|
||||
@rm -f $(LOCALOBJECTS) $(LOCALDEPENDS) $(ARNAME) || true
|
||||
|
||||
.PHONY: cleandeps
|
||||
cleandeps:
|
||||
@for dir in $(SUBDIRS); do \
|
||||
depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
@if [ "$(ARCH)" = "any" ]; then \
|
||||
for arch in $(ARCHS); do \
|
||||
echo "ARCH: $$arch"; \
|
||||
$(MAKE) -s -S $(MAKECMDGOALS) $$arch; \
|
||||
done; \
|
||||
echo " <$$dir>"; \
|
||||
$(MAKE) -s -S -C $$dir $@ $(ARCH); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
true; \
|
||||
else \
|
||||
for dir in $(SUBDIRS); do \
|
||||
depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
echo " <$$dir>"; \
|
||||
$(MAKE) -s -S -C $$dir $@ $(ARCH); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
echo " </$$dir>"; \
|
||||
done; \
|
||||
echo " </$$dir>"; \
|
||||
done; \
|
||||
true
|
||||
@rm -f $(LOCALDEPENDS) $(TARGETS) || true
|
||||
|
||||
.PHONY: cleanall
|
||||
cleanall:
|
||||
@for dir in $(SUBDIRS); do \
|
||||
depth=$(MAKELEVEL); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
for target in $(TARGETS); do \
|
||||
rm -f $$target.$(ARCH); \
|
||||
done; \
|
||||
echo " <$$dir>"; \
|
||||
$(MAKE) -s -S -C $$dir $@ $(ARCH); \
|
||||
while [ $${depth} -gt 0 ] ; do \
|
||||
echo -n " "; \
|
||||
depth=`expr $$depth - 1`; \
|
||||
done; \
|
||||
echo " </$$dir>"; \
|
||||
done; \
|
||||
true
|
||||
@rm -f *.d.* *.o.*
|
||||
@rm -f $(ARNAME) $(TARGETS) || true
|
||||
true; \
|
||||
fi
|
||||
@rm -f $(LOCALDEPENDS) || true
|
||||
|
||||
.PHONY: $(ARCH)
|
||||
$(ARCH):
|
||||
@if [ "$(words $(MAKECMDGOALS))" = "1" ]; then \
|
||||
$(MAKE) -s -S $(.DEFAULT_GOAL) $(ARCH); \
|
||||
@if [ "$(words $(MAKECMDGOALS))" = "0" ]; then \
|
||||
if [ "$(ARCH)" = "any" ]; then \
|
||||
for arch in $(ARCHS); do \
|
||||
echo "ARCH: $$arch"; \
|
||||
$(MAKE) -s -S $(.DEFAULT_GOAL) $$arch; \
|
||||
done; \
|
||||
true; \
|
||||
else \
|
||||
$(MAKE) -s -S $(.DEFAULT_GOAL) $(ARCH); \
|
||||
fi \
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user