162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ciuname_M := $(shell uname -m 2>/dev/null || echo not)
362306a36Sopenharmony_ciARCH ?= $(shell echo $(uname_M) | sed -e s/x86_64/x86/)
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciifneq ($(ARCH),sparc64)
662306a36Sopenharmony_cinothing:
762306a36Sopenharmony_ci.PHONY: all clean run_tests install
862306a36Sopenharmony_ci.SILENT:
962306a36Sopenharmony_cielse
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciSUBDIRS := drivers
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciTEST_PROGS := run.sh
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci.PHONY: all clean
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciinclude ../lib.mk
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciall:
2162306a36Sopenharmony_ci	@for DIR in $(SUBDIRS); do		\
2262306a36Sopenharmony_ci		BUILD_TARGET=$(OUTPUT)/$$DIR;	\
2362306a36Sopenharmony_ci		mkdir $$BUILD_TARGET  -p;	\
2462306a36Sopenharmony_ci		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
2562306a36Sopenharmony_ci		#SUBDIR test prog name should be in the form: SUBDIR_test.sh \
2662306a36Sopenharmony_ci		TEST=$$DIR"_test.sh"; \
2762306a36Sopenharmony_ci		if [ -e $$DIR/$$TEST ]; then \
2862306a36Sopenharmony_ci			rsync -a $$DIR/$$TEST $$BUILD_TARGET/; \
2962306a36Sopenharmony_ci		fi \
3062306a36Sopenharmony_ci	done
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_cioverride define INSTALL_RULE
3362306a36Sopenharmony_ci	mkdir -p $(INSTALL_PATH)
3462306a36Sopenharmony_ci	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	@for SUBDIR in $(SUBDIRS); do \
3762306a36Sopenharmony_ci		BUILD_TARGET=$(OUTPUT)/$$SUBDIR;	\
3862306a36Sopenharmony_ci		mkdir $$BUILD_TARGET  -p;	\
3962306a36Sopenharmony_ci		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
4062306a36Sopenharmony_ci	done;
4162306a36Sopenharmony_ciendef
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cioverride define CLEAN
4462306a36Sopenharmony_ci	@for DIR in $(SUBDIRS); do		\
4562306a36Sopenharmony_ci		BUILD_TARGET=$(OUTPUT)/$$DIR;	\
4662306a36Sopenharmony_ci		mkdir $$BUILD_TARGET  -p;	\
4762306a36Sopenharmony_ci		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
4862306a36Sopenharmony_ci	done
4962306a36Sopenharmony_ciendef
5062306a36Sopenharmony_ciendif
51