18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ciuname_M := $(shell uname -m 2>/dev/null || echo not)
38c2ecf20Sopenharmony_ciARCH ?= $(shell echo $(uname_M) | sed -e s/x86_64/x86/)
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciifneq ($(ARCH),sparc64)
68c2ecf20Sopenharmony_cinothing:
78c2ecf20Sopenharmony_ci.PHONY: all clean run_tests install
88c2ecf20Sopenharmony_ci.SILENT:
98c2ecf20Sopenharmony_cielse
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciSUBDIRS := drivers
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciTEST_PROGS := run.sh
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci.PHONY: all clean
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciinclude ../lib.mk
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciall:
218c2ecf20Sopenharmony_ci	@for DIR in $(SUBDIRS); do		\
228c2ecf20Sopenharmony_ci		BUILD_TARGET=$(OUTPUT)/$$DIR;	\
238c2ecf20Sopenharmony_ci		mkdir $$BUILD_TARGET  -p;	\
248c2ecf20Sopenharmony_ci		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
258c2ecf20Sopenharmony_ci		#SUBDIR test prog name should be in the form: SUBDIR_test.sh \
268c2ecf20Sopenharmony_ci		TEST=$$DIR"_test.sh"; \
278c2ecf20Sopenharmony_ci		if [ -e $$DIR/$$TEST ]; then \
288c2ecf20Sopenharmony_ci			rsync -a $$DIR/$$TEST $$BUILD_TARGET/; \
298c2ecf20Sopenharmony_ci		fi \
308c2ecf20Sopenharmony_ci	done
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cioverride define INSTALL_RULE
338c2ecf20Sopenharmony_ci	mkdir -p $(INSTALL_PATH)
348c2ecf20Sopenharmony_ci	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	@for SUBDIR in $(SUBDIRS); do \
378c2ecf20Sopenharmony_ci		BUILD_TARGET=$(OUTPUT)/$$SUBDIR;	\
388c2ecf20Sopenharmony_ci		mkdir $$BUILD_TARGET  -p;	\
398c2ecf20Sopenharmony_ci		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \
408c2ecf20Sopenharmony_ci	done;
418c2ecf20Sopenharmony_ciendef
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cioverride define CLEAN
448c2ecf20Sopenharmony_ci	@for DIR in $(SUBDIRS); do		\
458c2ecf20Sopenharmony_ci		BUILD_TARGET=$(OUTPUT)/$$DIR;	\
468c2ecf20Sopenharmony_ci		mkdir $$BUILD_TARGET  -p;	\
478c2ecf20Sopenharmony_ci		make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
488c2ecf20Sopenharmony_ci	done
498c2ecf20Sopenharmony_ciendef
508c2ecf20Sopenharmony_ciendif
51