-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (27 loc) · 686 Bytes
/
Copy pathMakefile
File metadata and controls
36 lines (27 loc) · 686 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
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -pedantic -std=c99 -O2 -D_POSIX_C_SOURCE=200809L -Iinclude
SRC_DIR = src
BUILD_DIR = build
TARGET = minishell
SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRCS))
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $@ $^
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
test: all
@echo "Running test suite..."
@if [ -x tests/run_tests.sh ]; then \
./tests/run_tests.sh; \
else \
echo "No tests implemented yet."; \
fi
clean:
rm -rf $(BUILD_DIR)
rm -f $(TARGET)
run: $(TARGET)
./$(TARGET)
.PHONY: all clean run test