1f08c3bdfSopenharmony_ciLSRC := ../linux
2f08c3bdfSopenharmony_ciBROWSER := firefox
3f08c3bdfSopenharmony_ci
4f08c3bdfSopenharmony_ciCFLAGS += -I ${LSRC}/arch/x86/kernel/cpu/mcheck/ -g -Wall
5f08c3bdfSopenharmony_ci
6f08c3bdfSopenharmony_ciKFLAGS := -I ./kinclude
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_ciEXE := tinjpage tsimpleinj tkillpoison tprctl tsoft tsoftinj thugetlb erst-inject
9f08c3bdfSopenharmony_ciEXE += ttranshuge
10f08c3bdfSopenharmony_ciEXEKERNEL := tring ttable
11f08c3bdfSopenharmony_ci
12f08c3bdfSopenharmony_ciOBJ := $(addsuffix .o,${EXE})
13f08c3bdfSopenharmony_ciOBJKERNEL := $(addsuffix .o,${EXEKERNEL})
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_ci.PHONY: clean distclean see test hard soft standalone
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ciall: standalone
18f08c3bdfSopenharmony_ci
19f08c3bdfSopenharmony_cistandalone: ${EXE}
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_cikernel: ${EXEKERNEL}
22f08c3bdfSopenharmony_ci
23f08c3bdfSopenharmony_citcases: tcases.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-severity.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-internal.h
24f08c3bdfSopenharmony_ci	${CC} ${CFLAGS} ${KFLAGS} -o tcases tcases.c
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_cittable: ttable.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-severity.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-internal.h
27f08c3bdfSopenharmony_ci	${CC} ${CFLAGS} ${KFLAGS} -o ttable ttable.c
28f08c3bdfSopenharmony_ci
29f08c3bdfSopenharmony_citprctl: tprctl.o
30f08c3bdfSopenharmony_ci
31f08c3bdfSopenharmony_citring: tring.o 
32f08c3bdfSopenharmony_ci
33f08c3bdfSopenharmony_citring : LDFLAGS += -lpthread
34f08c3bdfSopenharmony_ci
35f08c3bdfSopenharmony_cix.html: ttable
36f08c3bdfSopenharmony_ci	./ttable ${TFLAGS} > x.html
37f08c3bdfSopenharmony_ci
38f08c3bdfSopenharmony_ciinclude erst-inj/erst-inj.mk
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_ci.PHONY: see
41f08c3bdfSopenharmony_ci
42f08c3bdfSopenharmony_cisee: x.html
43f08c3bdfSopenharmony_ci	${BROWSER} x.html
44f08c3bdfSopenharmony_ci
45f08c3bdfSopenharmony_citinjpage: LDFLAGS += -lpthread
46f08c3bdfSopenharmony_ci
47f08c3bdfSopenharmony_ci.PHONY: clean distclean
48f08c3bdfSopenharmony_ci
49f08c3bdfSopenharmony_ciclean:
50f08c3bdfSopenharmony_ci	rm -f ${EXE} ${OBJ}
51f08c3bdfSopenharmony_ci	rm -f ${EXEKERNEL} ${OBJKERNEL}
52f08c3bdfSopenharmony_ci	rm -f x.html unpoison-failed offlined
53f08c3bdfSopenharmony_ci	rm -f ~test* ~poison*
54f08c3bdfSopenharmony_ci
55f08c3bdfSopenharmony_cidistclean: clean
56f08c3bdfSopenharmony_ci
57f08c3bdfSopenharmony_citest: soft hard
58f08c3bdfSopenharmony_ci
59f08c3bdfSopenharmony_cihard: standalone
60f08c3bdfSopenharmony_ci	./tinjpage
61f08c3bdfSopenharmony_ci	./tsimpleinj
62f08c3bdfSopenharmony_ci	if ! ./tkillpoison ; then echo "killed as expected" ; exit 0 ; else echo "didn't get killed" ; exit 1 ; fi
63f08c3bdfSopenharmony_ci	./tprctl
64f08c3bdfSopenharmony_ci
65f08c3bdfSopenharmony_cisoft: standalone
66f08c3bdfSopenharmony_ci	./tsoft
67f08c3bdfSopenharmony_ci	./tsoftinj
68f08c3bdfSopenharmony_ci	echo "Running soft offliner for 60 seconds"
69f08c3bdfSopenharmony_ci	./random_offline -t 60
70f08c3bdfSopenharmony_ci
71f08c3bdfSopenharmony_citest-kernel: tcases
72f08c3bdfSopenharmony_ci	./tcases
73f08c3bdfSopenharmony_ci
74f08c3bdfSopenharmony_citest-erst: erst-inject
75f08c3bdfSopenharmony_ci	./erst-inject.sh
76