This repository was archived by the owner on Mar 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
77 lines (50 loc) · 1.82 KB
/
Copy pathmakefile
File metadata and controls
77 lines (50 loc) · 1.82 KB
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
BIN_NAME=compressor
C_SOURCE=$(wildcard ./source/*.c)
H_SOURCE=$(wildcard ./include/*.h)
OBJ=$(subst .c,.o,$(subst source,object,$(C_SOURCE)))
CPL=gcc
CPL_FLAGS=-c \
-lm \
-W \
-Wall
VALGRIND_FLAGS=-s \
--leak-check=full \
--show-leak-kinds=all \
--show-reachable=yes \
--track-origins=yes \
--verbose
run: all
@ ./bin/${BIN_NAME}
valgrind: all
@ clear
@ valgrind ${VALGRIND_FLAGS} ./bin/${BIN_NAME} zip ./input/porque_aprender_programação.txt --verbose
@ echo "\n ------------------------------------------ \n"
@ valgrind ${VALGRIND_FLAGS} ./bin/${BIN_NAME} unzip ./temp/zipped.bin -v
diff: all
@ echo ''
@ diff -r ./input/porque_aprender_programação.txt ./output/porque_aprender_programação.txt --color=always
all: objectFolder ./bin/${BIN_NAME}
@ echo " \033[1;32m Done! \033[0m "
@ echo ''
objectFolder:
@ mkdir -p input output
@ mkdir -p object temp
@ mkdir -p bin
./bin/${BIN_NAME}: ${OBJ}
@ ${CPL} $^ -o $@
@ echo " \033[0;33m Building Binary \033[43;1;37m$@\033[0m\033[0;33m \033[0m "
@ echo ''
./object/%.o: ./source/%.c ./include/%.h
@ ${CPL} $< ${CPL_FLAGS} -o $@ -I ./include
@ echo " \033[0;35m Generating compilation object \033[45;1;37m$@\033[0m\033[0;35m \033[0m "
@ echo ''
./object/main.o: ./source/main.c ${H_SOURCE}
@ ${CPL} $< ${CPL_FLAGS} -o $@ -I ./include
@ echo " \033[0;34m Generating compilation object \033[44;1;37m$@\033[0m\033[0;34m \033[0m "
@ echo ''
clean:
@ rm -rf ./object/*.o ./object/*.i ./object/*.s *~ ./bin/${BIN_NAME}
@ rmdir object bin
@ rm -rf ./output/*.txt ./temp/
@ echo " \033[1;31m Removing binary \033[41;1;37m./bin/${BIN_NAME}\033[0m\033[1;31m and compilation objects \033[41;1;37m${OBJ}\033[0m\033[1;31m and backup or output files \033[0m "
@ echo ''