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