-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
executable file
·92 lines (78 loc) · 2.17 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
CC= gcc
CFLAGS= -W -Wall -ansi -pedantic
LDFLAGS= -L $(LIB) -lhuffman
INCFLAGS= -Iinclude
LIB=lib
SRC=src
OBJ=obj
BIN=bin
EXEC= HUFFMAN
all : directories $(EXEC)
#Creation bin , obj , lib
directories : ${OBJ} ${LIB} ${BIN}
${OBJ}:
mkdir -p ${OBJ}
${BIN}:
mkdir -p ${BIN}
${LIB}:
mkdir -p ${LIB}
#Fichier Executable
$(EXEC) : $(OBJ)/main.o $(LIB)/libhuffman.a
$(CC) $(CFLAGS) -o $(BIN)/$@ $^ $(LDFLAGS)
# Fichiers Objet
$(OBJ)/huffman.o : $(SRC)/huffman.c
$(CC) -c $< -o $@ $(CFLAGS) $(INCFLAGS)
$(OBJ)/main.o : $(SRC)/main.c
$(CC) -c $< -o $@ $(CFLAGS) $(INCFLAGS)
# Bibliotheques
$(LIB)/libhuffman.a : $(OBJ)/huffman.o
ar -rs $@ $^
.PHONY : all proper clean cleanall runCom runDec bench
#Nettoyage
proper:
rm -f *~ $(SRC)/*~ include/*~ test/*.huff test/*.decomp
clean : proper
rm -f $(OBJ)/*.o $(BIN)/$(EXEC) $(LIB)/*
cleanall: clean
rm -rf $(OBJ) $(BIN) $(LIB)
runCom:
@echo ""
@echo " COMPRESSION "
@echo ""
@echo "# Test Compression : test.txt"
@./$(BIN)/$(EXEC) -c test/test.txt
@echo ""
@echo "# Test Compression : test.doc"
@./$(BIN)/$(EXEC) -c test/test.doc
@echo ""
@echo "# Test Compression : test.csv"
@./$(BIN)/$(EXEC) -c test/test.csv
@echo ""
@echo "# Test Compression : test (binary)"
@./$(BIN)/$(EXEC) -c test/test
@echo ""
@echo "# Test Compression : test.avi"
@./$(BIN)/$(EXEC) -c test/test.avi
@echo ""
@echo "# Test Compression : test.mp4"
@./$(BIN)/$(EXEC) -c test/test.mp4
@echo ""
runDec:
@echo ""
@echo " DECOMPRESSION "
@echo ""
@echo "# Test Decompression : test.txt.huff => test.txt.decomp"
@./$(BIN)/$(EXEC) -d test/test.txt.huff
@echo "# Test Decompression : test.doc.huff => test.doc.decomp"
@./$(BIN)/$(EXEC) -d test/test.doc.huff
@echo "# Test Decompression : test.csv.huff => test.csv.decomp"
@./$(BIN)/$(EXEC) -d test/test.csv.huff
@echo "# Test Decompression : test.huff => test.decomp (binary)"
@./$(BIN)/$(EXEC) -d test/test.huff
@echo "# Test Decompression : test.avi.huff => test.avi.decomp"
@./$(BIN)/$(EXEC) -d test/test.avi.huff
@echo "# Test Decompression : test.mp4.huff => test.mp4.decomp"
@./$(BIN)/$(EXEC) -d test/test.mp4.huff
@echo ""
@ls -l test
bench: all runCom runDec cleanall