-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
65 lines (43 loc) · 1020 Bytes
/
makefile
File metadata and controls
65 lines (43 loc) · 1020 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
TARGET = ks.exe
SRCS = part2.c\
part1.c\
main.c\
#to add a file, put filename.extension\ before
OBJ_DIR = ./obj
SRC_DIR = ./src
BIN_DIR = ./bin
INC_DIR = ./include
DEP_DIRS =
OBJS = $(patsubst %.c, $(OBJ_DIR)/%.o, $(SRCS))
SYS_LIBS =
INCLUDES = -I$(INC_DIR) $(addprefix -I, $(DEP_DIRS))
LDLIBS = $(addprefix -l, $(SYS_LIBS))
LDFLAGS = -W -Wall
CXX = gcc
.PHONY: all clean fclean
debug: CFLAGS += -DDEBUG
debug: CXXFLAGS += -g
debug: LDFLAGS += -g
debug: all
release: CFLAGS += -O2
release: CFLAGS += -DRELEASE
release: clean all
all: $(TARGET)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
$(CXX) $(CXXFLAGS) $(CFLAGS) -c $< -o $@
$(TARGET): $(BIN_DIR)/$(TARGET)
$(BIN_DIR)/$(TARGET): $(OBJS) | $(BIN_DIR)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
$(OBJS): $(OBJ_DIR)
$(OBJ_DIR):
mkdir -p $@
$(BIN_DIR):
mkdir -p $@
clean:
$(RM) $(OBJS)
fclean: clean
$(RM) $(BIN_DIR)/$(TARGET)
rodolphe: CFLAGS += -DRODOLPHE
rodolphe: clean debug
antoine: CFLAGS += -DANTOINE
antoine: clean debug