-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (40 loc) · 1.5 KB
/
Makefile
File metadata and controls
66 lines (40 loc) · 1.5 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
CC := gcc
RM := rm -rf
CFLAGS += -Iinclude -Wall -Wextra -Werror -g
SRCS := $(wildcard src/*.c)
SRCS_TEST := $(wildcard src/input.c src/parse.c src/game_logic.c test/main.c)
SRCS_STR := $(wildcard src/my_string.c test/main_str.c)
OBJS := $(SRCS:.c=.o)
OBJS_TEST := $(SRCS_TEST:.c=.o)
OBJS_STR := $(SRCS_STR:.c=.o)
NAME := kolesnyk
NAME_TEST := filler_test
NAME_STR := string_test
all: $(NAME)
$(NAME): $(OBJS)
$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(LDFLAGS) -lm
$(NAME_TEST): $(OBJS_TEST)
$(CC) $(CFLAGS) -o $(NAME_TEST) $(OBJS_TEST) $(LDFLAGS) -lm
$(NAME_STR): $(OBJS_STR)
$(CC) $(CFLAGS) -o $(NAME_STR) $(OBJS_STR) $(LDFLAGS) -lm
clean:
$(RM) $(OBJS) $(OBJS_TEST)
fclean: clean
$(RM) $(NAME_TEST)
re: fclean $(NAME_TEST)
re_str: fclean $(NAME_STR)
test: re
@(./$(NAME_TEST) && echo "Test success" || echo "Test Fails")
test_valgrind: re
@(valgrind ./$(NAME_TEST) && echo "Test success" || echo "Test Fails")
test_string: re_str
@(./$(NAME_STR) && echo "Test success" || echo "Test Fails")
test_string_valgrind: re_str
@(valgrind --track-origins=yes ./$(NAME_STR) && echo "Test success" || echo "Test Fails")
debug: $(NAME)
valgrind -v --leak-check=full --track-origins=yes ./$(NAME)
stream_test: src/stream.c src/stream_test.c include/stream.h
gcc -o str src/stream.c src/stream_test.c
./str
stream_debug: stream_test
valgrind --leak-check=full -v ./str