-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (70 loc) · 2.07 KB
/
Copy pathMakefile
File metadata and controls
86 lines (70 loc) · 2.07 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
77
78
79
80
81
82
83
84
85
86
CC := gcc
CFLAGS := -std=c11 -Wall -Wextra -Wpedantic -g
CPPFLAGS := -Iinclude -D_POSIX_C_SOURCE=200809L
TARGET := minishell
SOURCES := \
src/main.c \
src/builtins.c \
src/executor.c \
src/input.c \
src/lexer.c \
src/parser.c \
src/signals.c
LEXER_TEST := test_lexer
PARSER_TEST := test_parser
EXECUTOR_TEST := test_executor
REDIRECTION_TEST := test_redirection
PIPELINE_TEST := test_pipeline
INPUT_TEST := test_input
TEST_TARGETS := \
$(INPUT_TEST) \
$(LEXER_TEST) \
$(PARSER_TEST) \
$(EXECUTOR_TEST) \
$(REDIRECTION_TEST) \
$(PIPELINE_TEST)
.PHONY: all run test clean
all: $(TARGET)
$(TARGET): $(SOURCES) include/shell.h include/input.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(SOURCES) -o $(TARGET)
run: $(TARGET)
./$(TARGET)
$(LEXER_TEST): tests/test_lexer.c src/lexer.c include/shell.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
tests/test_lexer.c src/lexer.c \
-o $(LEXER_TEST)
$(PARSER_TEST): tests/test_parser.c src/lexer.c src/parser.c include/shell.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
tests/test_parser.c src/lexer.c src/parser.c \
-o $(PARSER_TEST)
$(EXECUTOR_TEST): tests/test_executor.c src/executor.c src/signals.c include/shell.h include/signals.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
tests/test_executor.c src/executor.c src/signals.c \
-o $(EXECUTOR_TEST)
$(REDIRECTION_TEST): tests/test_redirection.c src/executor.c src/signals.c include/shell.h include/signals.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
tests/test_redirection.c \
src/executor.c \
src/signals.c \
-o $(REDIRECTION_TEST)
$(PIPELINE_TEST): tests/test_pipeline.c src/lexer.c src/parser.c src/executor.c src/signals.c include/shell.h include/signals.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
tests/test_pipeline.c \
src/lexer.c \
src/parser.c \
src/executor.c \
src/signals.c \
-o $(PIPELINE_TEST)
$(INPUT_TEST): tests/test_input.c src/input.c include/input.h
$(CC) $(CPPFLAGS) $(CFLAGS) \
tests/test_input.c src/input.c \
-o $(INPUT_TEST)
test: $(TEST_TARGETS)
./$(INPUT_TEST)
./$(LEXER_TEST)
./$(PARSER_TEST)
./$(EXECUTOR_TEST)
./$(REDIRECTION_TEST)
./$(PIPELINE_TEST)
clean:
rm -f $(TARGET) $(TEST_TARGETS)