Files
PresenceDetection/Makefile
T
2018-12-18 12:07:12 +01:00

68 lines
1.3 KiB
Makefile

#
# Makefile
#
include Makefile.conf
ARNAME = $(notdir $(CURDIR)).a
SUBDIRS := $(wildcard */.)
SUBDIRS := $(foreach dir,$(SUBDIRS),$(subst /.,,$(dir)))
FILTER = doc%
SUBDIRS := $(filter-out $(FILTER),$(SUBDIRS))
SUBDIRARS = $(foreach dir,$(SUBDIRS),$(dir)/$(dir).a)
LOCALSOURCES = $(wildcard *.cpp *.cc)
SOURCES = $(wildcard *.cpp */*.cpp */*/*.cpp */*/*/*.cpp)
LOCALOBJECT_ = $(LOCALSOURCES:.cpp=.o)
LOCALOBJECTS = $(LOCALOBJECT_:.cc=.o)
OBJECTS = $(SOURCES:.cpp=.o)
LOCALDEPENDS = $(LOCALOBJECTS:.o=.d)
DEPENDS = $(OBJECTS:.o=.d)
TARGETS =
-include Makefile.target
artifacts: $(SUBDIRS) $(LOCALOBJECTS)
ifneq ($(MAKECMDGOALS),clean)
-include $(LOCALDEPENDS)
endif
%.d: %.cpp
@echo [MM] $@
@$(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
%.o: %.cpp
@echo [CC] $@
@nice -n 19 $(CC) -c $(CFLAGS) $< -o $@
%.d: %.cc
@echo [MM] $@
@$(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
%.o: %.cc
@echo [CC] $@
@nice -n 19 $(CC) -c $(CFLAGS) $< -o $@
$(ARNAME): $(SUBDIRS) $(LOCALOBJECTS)
@echo [AR] $@
@nice -n 19 $(AR) rcuT $@ $(LOCALOBJECTS) $(SUBDIRARS)
$(OBJECTS): | $(SUBDIRS)
.PHONY: $(SUBDIRS)
$(SUBDIRS):
@$(MAKE) -S -C $@ artifacts
.PHONY: all
all: $(TARGETS)
.PHONY: clean
clean:
@for dir in $(SUBDIRS); do \
$(MAKE) -S -C $$dir $@; \
done
@rm -f $(LOCALOBJECTS) $(LOCALDEPENDS) $(ARNAME) $(TARGETS) || true