-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
33 lines (21 loc) · 735 Bytes
/
makefile
File metadata and controls
33 lines (21 loc) · 735 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
SRC := ./src
BUILD := ./build
INCLUDE := ./include
# Où copier l'exécutable (~/.local/bin est dans mon $PATH)
BIN_PATH := ~/.local/bin
C_FLAGS := -I $(INCLUDE) -Wall -g
C_LIBS := -lncurses -lm -lpthread
C_FILES := $(wildcard $(SRC)/*.c)
HEADERS := $(wildcard $(INCLUDE)/*.h)
OBJS := $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(C_FILES))
.PHONY: clean
ram: $(OBJS)
gcc $(C_FLAGS) $(OBJS) -o $@ $(C_LIBS)
cp ram $(BIN_PATH)
# Un fichier objet dépend de sa source mais également des headers.
# Ainsi si un header est modifié on recompile tous les objets pour être
# sûrs que les changements soient bien appliqués partout
$(BUILD)/%.o: $(SRC)/%.c $(HEADERS)
gcc $(C_FLAGS) -c $< -o $@ $(C_LIBS)
clean:
rm ./build/* ram