-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
45 lines (31 loc) · 820 Bytes
/
makefile
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
PROJ_NAME=overcooked
# .c files
C_SOURCE=$(wildcard ./src/*.c)
# .h files
H_SOURCE=$(wildcard ./include/*.h)
# Object files
OBJ=$(subst .c,.o,$(subst src,objects,$(C_SOURCE)))
# Compiler and linker
CC=gcc
# Flags for compiler
CC_FLAGS=-c \
-Wall \
-finput-charset=UTF-8
LIB_FLAGS=-lm\
-lncurses\
-lpthread\
# Command used at clean target
RM = rm -rf
# Compilation and linking
all: objFolder $(PROJ_NAME)
$(PROJ_NAME): $(OBJ)
$(CC) $^ -o $@ $(LIB_FLAGS)
./objects/%.o: ./src/%.c ./include/%.h
$(CC) $< $(CC_FLAGS) -o $@ $(LIB_FLAGS)
./objects/main.o: ./src/main.c $(H_SOURCE)
$(CC) $< $(CC_FLAGS) -o $@ $(LIB_FLAGS)
objFolder:
@mkdir -p objects
clean:
$(RM) ./objects/*.o $(PROJ_NAME) *~
.PHONY: all clean