Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 1 | # Makefile for powerpc selftests |
| 2 | |
| 3 | # ARCH can be overridden by the user for cross compiling |
| 4 | ARCH ?= $(shell uname -m) |
| 5 | ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/) |
| 6 | |
| 7 | ifeq ($(ARCH),powerpc) |
| 8 | |
| 9 | GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown") |
| 10 | |
Simon Guo | 15ec399 | 2016-09-30 10:32:51 +0800 | [diff] [blame] | 11 | CFLAGS := -std=gnu99 -Wall -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS) |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 12 | |
Michael Ellerman | 84f887b | 2015-03-04 21:41:31 +1100 | [diff] [blame] | 13 | export CFLAGS |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 14 | |
Chris Smart | 4375088 | 2016-06-17 09:34:47 +1000 | [diff] [blame] | 15 | SUB_DIRS = alignment \ |
| 16 | benchmarks \ |
Michael Ellerman | 65b6ba6 | 2015-10-14 20:50:35 +1100 | [diff] [blame] | 17 | copyloops \ |
Chris Smart | 438517e | 2016-05-02 13:51:38 +1000 | [diff] [blame] | 18 | context_switch \ |
Michael Ellerman | 65b6ba6 | 2015-10-14 20:50:35 +1100 | [diff] [blame] | 19 | dscr \ |
| 20 | mm \ |
| 21 | pmu \ |
Cyril Bur | ef18633 | 2016-09-23 16:18:19 +1000 | [diff] [blame] | 22 | signal \ |
Michael Ellerman | 65b6ba6 | 2015-10-14 20:50:35 +1100 | [diff] [blame] | 23 | primitives \ |
| 24 | stringloops \ |
| 25 | switch_endian \ |
| 26 | syscalls \ |
| 27 | tm \ |
Cyril Bur | 01127f1 | 2016-02-29 17:53:43 +1100 | [diff] [blame] | 28 | vphn \ |
Anshuman Khandual | f666ad4 | 2016-09-30 10:32:52 +0800 | [diff] [blame] | 29 | math \ |
| 30 | ptrace |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 31 | |
| 32 | endif |
| 33 | |
Michael Ellerman | a908f5d | 2015-03-18 12:02:41 +1100 | [diff] [blame] | 34 | all: $(SUB_DIRS) |
Michael Ellerman | cbfd7da | 2014-07-23 17:31:31 +1000 | [diff] [blame] | 35 | |
Michael Ellerman | a908f5d | 2015-03-18 12:02:41 +1100 | [diff] [blame] | 36 | $(SUB_DIRS): |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 37 | BUILD_TARGET=$$OUTPUT/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 38 | |
Michael Ellerman | 6faeeea | 2015-03-11 15:06:01 +1100 | [diff] [blame] | 39 | include ../lib.mk |
| 40 | |
| 41 | override define RUN_TESTS |
Michael Ellerman | a908f5d | 2015-03-18 12:02:41 +1100 | [diff] [blame] | 42 | @for TARGET in $(SUB_DIRS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 43 | BUILD_TARGET=$$OUTPUT/$$TARGET; \ |
| 44 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\ |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 45 | done; |
Michael Ellerman | 6faeeea | 2015-03-11 15:06:01 +1100 | [diff] [blame] | 46 | endef |
| 47 | |
| 48 | override define INSTALL_RULE |
Linus Torvalds | d19d5ef | 2015-04-16 13:53:32 -0500 | [diff] [blame] | 49 | @for TARGET in $(SUB_DIRS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 50 | BUILD_TARGET=$$OUTPUT/$$TARGET; \ |
| 51 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install;\ |
Michael Ellerman | 6faeeea | 2015-03-11 15:06:01 +1100 | [diff] [blame] | 52 | done; |
| 53 | endef |
| 54 | |
| 55 | override define EMIT_TESTS |
Linus Torvalds | d19d5ef | 2015-04-16 13:53:32 -0500 | [diff] [blame] | 56 | @for TARGET in $(SUB_DIRS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 57 | BUILD_TARGET=$$OUTPUT/$$TARGET; \ |
| 58 | $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests;\ |
Michael Ellerman | 6faeeea | 2015-03-11 15:06:01 +1100 | [diff] [blame] | 59 | done; |
| 60 | endef |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 61 | |
| 62 | clean: |
Michael Ellerman | a908f5d | 2015-03-18 12:02:41 +1100 | [diff] [blame] | 63 | @for TARGET in $(SUB_DIRS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 64 | BUILD_TARGET=$$OUTPUT/$$TARGET; \ |
Michael Ellerman | 2e8ec87 | 2017-02-09 19:56:29 +1100 | [diff] [blame] | 65 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ |
| 66 | done; |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 67 | rm -f tags |
| 68 | |
| 69 | tags: |
| 70 | find . -name '*.c' -o -name '*.h' | xargs ctags |
| 71 | |
Linus Torvalds | d19d5ef | 2015-04-16 13:53:32 -0500 | [diff] [blame] | 72 | .PHONY: tags $(SUB_DIRS) |