-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (60 loc) · 1.57 KB
/
Makefile
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
60
61
62
63
64
65
66
67
68
CC = gcc
LDFLAGS = -lpthread -rdynamic -ldl
CFLAGS = -Wall -Wextra
OBJECTS = main.o checkfile.o utils.o
PFLAGS = -xlp 4
PZFLAGS = -xlzp 4
GREEN=\033[0;32m
NC=\033[0m # No Color
all: ptar
ptar: $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
rm *.o
main.o: src/main.c src/utils.h
$(CC) $(CFLAGS) -c $<
checkfile.o: src/checkfile.c src/utils.h
$(CC) $(CFLAGS) -c $<
utils.o: src/utils.c src/utils.h src/checkfile.h
$(CC) $(CFLAGS) -c $<
clean:
rm -rf *.o
./scripts/rmtest.sh
mrproper: clean
rm -rf ptar
test:
@echo "Test on TAR files ...\n"
./ptar $(PFLAGS) archives_test/verysimple.tar
@echo ""
./ptar $(PFLAGS) archives_test/testf.tar
@echo ""
./ptar $(PFLAGS) archives_test/testall.tar
@echo ""
./ptar $(PFLAGS) archives_test/vice.tar
@echo ""
./ptar $(PFLAGS) archives_test/testlink.tar
@echo ""
./ptar $(PFLAGS) archives_test/testlien2.tar
@echo ""
@echo "Test a corrupted file ..."
./ptar $(PFLAGS) archives_test/testcorrupted.tar &> /dev/null
@sleep 1
@echo ""
@echo "${GREEN}Worked${NC}\n"
@sleep 1
@echo "Test on TAR.GZ files ..."
./ptar $(PZFLAGS) archives_test/testf.tar.gz
@echo ""
./ptar $(PZFLAGS) archives_test/testall.tar.gz
@echo ""
./ptar $(PZFLAGS) archives_test/testallbis.tar.gz
@echo ""
./ptar $(PZFLAGS) archives_test/vice.tar.gz
@echo ""
./ptar $(PZFLAGS) archives_test/bigarch.tar.gz
@echo ""
@echo "Test on a false archive ..."
./ptar $(PZFLAGS) archives_test/testfalsearch.tar.gz &> /dev/null
@sleep 1
@echo ""
@echo "${GREEN}Worked${NC}\n"
@echo "Finished all ${GREEN}good${NC}. To clean your folder, run \' make clean\'"