summaryrefslogtreecommitdiff
path: root/test/compression/Makefile
blob: ba83c871c63a8ad4e006974d6ac08ebfb4092be7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
CC=../../ccomp 
CFLAGS=-U__GNUC__ -stdlib ../../runtime -dclight -dasm
LIBS=
TIME=xtime -o /dev/null -mintime 1.0

EXE=arcode lzw lzss

COMMON_OBJS=optlist.o bitfile.o

all: $(EXE)

ARCODE_OBJS=$(COMMON_OBJS) arcode.o armain.o

arcode: $(ARCODE_OBJS)
	$(CC) $(CFLAGS) -o $@ $(ARCODE_OBJS) $(LIBS)

LZW_OBJS=$(COMMON_OBJS) lzwencode.o lzwdecode.o lzwmain.o

lzw: $(LZW_OBJS)
	$(CC) $(CFLAGS) -o $@ $(LZW_OBJS) $(LIBS)

LZSS_OBJS=$(COMMON_OBJS) lzvars.o lzhash.o lzencode.o lzdecode.o lzssmain.o

lzss: $(LZSS_OBJS)
	$(CC) $(CFLAGS) -o $@ $(LZSS_OBJS) $(LIBS)

TESTFILE=/mach_kernel
TESTCOMPR=/tmp/testcompr.out
TESTEXPND=/tmp/testexpnd.out

test:
	rm -f $(TESTCOMPR) $(TESTEXPND)
	@for i in $(EXE); do \
          echo "$$i: compression..."; \
          ./$$i -c -i $(TESTFILE) -o $(TESTCOMPR); \
          echo "$$i: decompression..."; \
          ./$$i -d -i $(TESTCOMPR) -o $(TESTEXPND); \
          if cmp $(TESTFILE) $(TESTEXPND); \
          then echo "$$i: passed"; \
          else echo "$$i: FAILED"; \
          fi; \
        done
	rm -f $(TESTCOMPR) $(TESTEXPND)

bench:
	rm -f $(TESTCOMPR)
	@for i in $(EXE); do \
          echo -n "$$i "; \
          $(TIME) sh -c "./$$i -c -i $(TESTFILE) -o $(TESTCOMPR) && ./$$i -d -i $(TESTCOMPR) -o /dev/null"; \
         done
	rm -f $(TESTCOMPR)

include .depend

clean:
	rm -f *.o *.light.c *.s $(EXE)

depend:
	gcc -MM *.c > .depend