-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (30 loc) 路 682 Bytes
/
Copy pathMakefile
File metadata and controls
42 lines (30 loc) 路 682 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
SRC = ./src
OBJ = ./obj
BIN = ./bin
DIRS = $(SRC) $(OBJ) $(BIN)
SOURCES = $(wildcard $(SRC)/*.c)
OBJECTS = $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(SOURCES))
HEADERS = $(wildcard $(SRC)/*.h)
TARGET = $(BIN)/circus
CC = gcc
CFLAGS = -Wall -Wextra -Werror -std=c99 -pedantic
.PHONY: default all clean run debug dirs rund
default: dirs $(TARGET)
all: default
dirs: $(DIRS)
$(DIRS):
mkdir -p $@
debug: CFLAGS += -DDEBUG -g
debug: default
$(OBJ)/%.o: $(SRC)/%.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(CFLAGS) -o $@
clean:
rm -f $(OBJECTS)
rm -f $(TARGET)
run: default
$(TARGET)
rund: debug
$(TARGET)