-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (26 loc) · 672 Bytes
/
Makefile
File metadata and controls
36 lines (26 loc) · 672 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 -pedantic -std=c11
DEBUG_FLAGS = -g -O0
RELEASE_FLAGS = -O2
LIBS = -ledit -lcurl
SRC_DIR = src
INC_DIR = include
BUILD_DIR = build
BIN_DIR = bin
SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(SRCS:$(SRC_DIR)/%.c=$(BUILD_DIR)/%.o)
TARGET = $(BIN_DIR)/ghost-shell
.PHONY: all clean debug release
all: release
debug: CFLAGS += $(DEBUG_FLAGS) -DDEBUG
debug: $(TARGET)
release: CFLAGS += $(RELEASE_FLAGS)
release: $(TARGET)
$(TARGET): $(OBJS)
@mkdir -p $(BIN_DIR)
$(CC) $(OBJS) -o $(TARGET) $(LIBS)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(BUILD_DIR)
$(CC) $(CFLAGS) -I$(INC_DIR) -c $< -o $@
clean:
rm -rf $(BUILD_DIR) $(BIN_DIR)