Makefile: Checking SNAP_ROOT before executing hardware targets
@@ -22,11 +22,21 @@ all: $(software_subdirs) $(hardware_subdirs)
# Only build if the subdirectory is really existent
.PHONY: $(software_subdirs) $(hardware_subdirs)
-$(software_subdirs) $(hardware_subdirs):
+$(software_subdirs):
@if [ -d $@ ]; then \
$(MAKE) -C $@ || exit 1; \
fi
+$(hardware_subdirs):
+ @if [ -d $@ ]; then \
+ if [ -d "$(SNAP_ROOT)" ]; then \
+ $(MAKE) -C $@ || exit 1; \
+ else \
+ echo "WARNING: Environment variable SNAP_ROOT does not point to a directory."; \
+ echo " Please prepare hardware environment (see hardware/README.md) before building hardware."; \
+ fi \
+ fi
+
# Install/uninstall
test install uninstall:
@for dir in $(software_subdirs); do \
@@ -39,7 +49,12 @@ test install uninstall:
config model image:
@for dir in $(hardware_subdirs); do \
if [ -d $$dir ]; then \
+ if [ -d "$(SNAP_ROOT)" ]; then \
$(MAKE) -C $$dir $@ || exit 1; \
+ else \
+ echo "WARNING: Environment variable SNAP_ROOT does not point to a directory."; \
+ echo " Please prepare hardware environment (see hardware/README.md) before building hardware."; \
+ fi \
fi \
done
