Pintu Agarwal | 47a18c4 | 2017-11-01 13:00:39 -0400 | [diff] [blame^] | 1 | SUBDIRS := ion |
| 2 | |
| 3 | TEST_PROGS := run.sh |
| 4 | |
| 5 | .PHONY: all clean |
| 6 | |
| 7 | include ../lib.mk |
| 8 | |
| 9 | all: |
| 10 | @for DIR in $(SUBDIRS); do \ |
| 11 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
| 12 | mkdir $$BUILD_TARGET -p; \ |
| 13 | make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
| 14 | #SUBDIR test prog name should be in the form: SUBDIR_test.sh |
| 15 | TEST=$$DIR"_test.sh"; \ |
| 16 | if [ -e $$DIR/$$TEST ]; then |
| 17 | rsync -a $$DIR/$$TEST $$BUILD_TARGET/; |
| 18 | fi |
| 19 | done |
| 20 | |
| 21 | override define RUN_TESTS |
| 22 | @cd $(OUTPUT); ./run.sh |
| 23 | endef |
| 24 | |
| 25 | override define INSTALL_RULE |
| 26 | mkdir -p $(INSTALL_PATH) |
| 27 | install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) |
| 28 | |
| 29 | @for SUBDIR in $(SUBDIRS); do \ |
| 30 | BUILD_TARGET=$(OUTPUT)/$$SUBDIR; \ |
| 31 | mkdir $$BUILD_TARGET -p; \ |
| 32 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$SUBDIR INSTALL_PATH=$(INSTALL_PATH)/$$SUBDIR install; \ |
| 33 | done; |
| 34 | endef |
| 35 | |
| 36 | override define EMIT_TESTS |
| 37 | echo "./run.sh" |
| 38 | endef |
| 39 | |
| 40 | override define CLEAN |
| 41 | @for DIR in $(SUBDIRS); do \ |
| 42 | BUILD_TARGET=$(OUTPUT)/$$DIR; \ |
| 43 | mkdir $$BUILD_TARGET -p; \ |
| 44 | make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\ |
| 45 | done |
| 46 | endef |