###
# update dependencies
-$(topsrcdir)/$(builddir)/%.d : %.c
- @echo "[ CPP ] ==> $(patsubst $(topsrcdir)/%,%,$@)";
- $(Q)$(CPP) $CPPFLAGS) -o "$@" "$<";
+$(top_builddir)$(builddir)/%.d : %.c
+ifndef SILENT
+ @echo "[ CPP ] ==> $(patsubst $(top_builddir)%,%,$@)"
+endif
+ $(Q)$(CPP) $(CPPFLAGS) -o "$@" "$<"
# assemble
-$(topsrcdir)/$(builddir)/%.o : %.S
- @echo "[ AS ] ==> $(patsubst $(topsrcdir)/%,%,$@)";
- $(Q)$(AS) $(ASFLAGS) -o "$@" -c "$<";
+$(top_builddir)$(builddir)/%.o : %.S
+ifndef SILENT
+ @echo "[ AS ] ==> $(patsubst $(top_builddir)%,%,$@)"
+endif
+ $(Q)$(AS) $(ASFLAGS) -o "$@" -c "$<"
# compile
-$(topsrcdir)/$(builddir)/%.o : %.c
- @echo "[ CC ] ==> $(patsubst $(topsrcdir)/%,%,$@)";
- $(Q)$(CC) $(CFLAGS) -o "$@" -c "$<";
+$(top_builddir)$(builddir)/%.o : %.c
+ifndef SILENT
+ @echo "[ CC ] ==> $(patsubst $(top_builddir)%,%,$@)"
+endif
+ $(Q)$(CC) $(CFLAGS) -o "$@" -c "$<"
# create library
ifneq (,$(strip $(LIB_O)))
%.lib : $(LIB_O)
- @echo "[ LIB ] $(patsubst $(topsrcdir)/%,%,$@) <== $(patsubst $(topsrcdir)/$(builddir)/%,%,$^)";
- $(Q)$(RM) "$@"; $(LIB) $(LIBFLAGS) "$@" $^;
+ifndef SILENT
+ @echo "[ LIB ] $(patsubst $(top_builddir)%,%,$@) <== $(patsubst $(top_builddir)$(builddir)/%,%,$^)"
+endif
+ $(Q)$(RM) "$@"; $(LIB) $(LIBFLAGS) "$@" $^
else
-%.lib : force
- @echo "[ LIB ] $(patsubst $(topsrcdir)/%,%,$@) <== **/*.o";
- $(Q)$(RM) "$@"; LIB_O=`find "$(topsrcdir)/$(builddir)" -name "*.o"`; [ "x$${LIB_O}" = "x" ] || $(LIB) $(LIBFLAGS) "$@" $${LIB_O};
+%.lib : recurse
+ifndef SILENT
+ @echo "[ LIB ] $(patsubst $(top_builddir)%,%,$@) <== **/*.o"
+endif
+ $(Q)$(RM) "$@"; LIB_O=`find "$(top_builddir)$(builddir)" -name "*.o"`; echo $${LIB_O}; [ "x$${LIB_O}" = "x" ] || $(LIB) $(LIBFLAGS) "$@" $${LIB_O}
endif
-.PHONY : builddir recurse force
-
-# create builddir
-builddir : force
- $(Q)[ -d "$(topsrcdir)/$(builddir)" ] || $(MKDIR) "$(topsrcdir)/$(builddir)";
+.PHONY : recurse force
# build sub-directories
+ifneq (,$(strip $(SUBDIRS)))
recurse : force
- $(Q)for DIR in $(SUBDIRS) . ; do \
- [ "$${DIR}" = "." ] || $(GREP) "^$${ARCH}$$" "$${DIR}.ignore" &> /dev/null || $(MAKE) -C "$${DIR}" builddir="$(builddir)/$${DIR}" $(MAKECMDGOALS) || exit 1; \
+ $(Q)+for DIR in $(SUBDIRS) ; do \
+ $(GREP) "^$${ARCH}$$" "$(srcdir)/$${DIR}.ignore" &> /dev/null || ( \
+ $(MKDIR) "$(top_builddir)$(builddir)/$${DIR}"; \
+ $(MAKE) -C "$${DIR}" builddir="$(builddir)/$${DIR}" $(MAKECMDGOALS); \
+ ) || exit 1; \
done
+else
+recurse :
+ @# nothing to do
+endif
# target to force remaking of (seemingly) independent targets
force :