-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
44 lines (34 loc) · 860 Bytes
/
makefile
File metadata and controls
44 lines (34 loc) · 860 Bytes
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
CC = gcc
CFLAGS = -Wall -Wextra -std=c11 -pthread
CPPFLAGS = -D_POSIX_C_SOURCE=200809L -I./include
DEBUG_FLAGS = -g3 -O0 -DDEBUG
BUILD_DIR = build
TARGET = $(BUILD_DIR)/dshell
SRCS = main.c \
src/shell.c \
src/parser.c \
src/builtins.c \
src/history.c \
src/utils.c \
src/jobs.c \
src/executor.c \
src/signals.c \
src/logger.c
OBJS = $(addprefix $(BUILD_DIR)/,$(SRCS:.c=.o))
DEPS = $(OBJS:.o=.d)
$(TARGET): $(OBJS)
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(OBJS) -o $(TARGET)
$(BUILD_DIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -MMD -MP -c $< -o $@
clean:
rm -rf $(BUILD_DIR)
rm -rf src/bin
rm -f dshell main.o main.d src/*.o src/*.d *.log
test: $(TARGET)
sh test/run_examples.sh
debug: CFLAGS += $(DEBUG_FLAGS)
debug: clean $(TARGET)
.PHONY: clean debug test
-include $(DEPS)