1#
2# This is a simple Makefile to test some of the RAID-6 code
3# from userspace.
4#
5
6CC	 = gcc
7OPTFLAGS = -O2			# Adjust as desired
8CFLAGS	 = -I.. -I ../../../include -g $(OPTFLAGS)
9LD	 = ld
10AWK	 = awk -f
11AR	 = ar
12RANLIB	 = ranlib
13
14.c.o:
15	$(CC) $(CFLAGS) -c -o $@ $<
16
17%.c: ../%.c
18	cp -f $< $@
19
20%.uc: ../%.uc
21	cp -f $< $@
22
23all:	raid6.a raid6test
24
25raid6.a: int1.o int2.o int4.o int8.o int16.o int32.o mmx.o sse1.o sse2.o \
26	 altivec1.o altivec2.o altivec4.o altivec8.o recov.o algos.o \
27	 tables.o
28	 rm -f $@
29	 $(AR) cq $@ $^
30	 $(RANLIB) $@
31
32raid6test: test.c raid6.a
33	$(CC) $(CFLAGS) -o raid6test $^
34
35altivec1.c: altivec.uc ../unroll.awk
36	$(AWK) ../unroll.awk -vN=1 < altivec.uc > $@
37
38altivec2.c: altivec.uc ../unroll.awk
39	$(AWK) ../unroll.awk -vN=2 < altivec.uc > $@
40
41altivec4.c: altivec.uc ../unroll.awk
42	$(AWK) ../unroll.awk -vN=4 < altivec.uc > $@
43
44altivec8.c: altivec.uc ../unroll.awk
45	$(AWK) ../unroll.awk -vN=8 < altivec.uc > $@
46
47int1.c: int.uc ../unroll.awk
48	$(AWK) ../unroll.awk -vN=1 < int.uc > $@
49
50int2.c: int.uc ../unroll.awk
51	$(AWK) ../unroll.awk -vN=2 < int.uc > $@
52
53int4.c: int.uc ../unroll.awk
54	$(AWK) ../unroll.awk -vN=4 < int.uc > $@
55
56int8.c: int.uc ../unroll.awk
57	$(AWK) ../unroll.awk -vN=8 < int.uc > $@
58
59int16.c: int.uc ../unroll.awk
60	$(AWK) ../unroll.awk -vN=16 < int.uc > $@
61
62int32.c: int.uc ../unroll.awk
63	$(AWK) ../unroll.awk -vN=32 < int.uc > $@
64
65tables.c: mktables
66	./mktables > tables.c
67
68clean:
69	rm -f *.o *.a mktables mktables.c *.uc int*.c altivec*.c tables.c raid6test
70
71spotless: clean
72	rm -f *~
73