forked from gaelfoppolo/examples-learning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
40 lines (34 loc) · 719 Bytes
/
makefile
File metadata and controls
40 lines (34 loc) · 719 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
##
#
# @gaelfoppolo FOPPOLO Gaël
# @Ebatsin PHILIP Bastien
#
# @brief Makefile
#
# To generate : type "make" or "make learning"
# To clean : type "make clean" or "make extraclean"
#
##
# Declaration of variables
CC = clang
CC_FLAGS = -Wall -O2
CC_LIBS = -lm
RM = rm -rf
# File names
OUT = learning
# Looking for C files in working and subdirectories
SOURCES = $(wildcard *.c) $(wildcard */*.c)
OBJECTS = $(SOURCES:.c=.o)
# Main target
$(OUT): $(OBJECTS)
$(CC) $(OBJECTS) -o $(OUT) $(CC_LIBS)
# To obtain object files
%.o: %.c
$(CC) -c $(CC_FLAGS) $< -o $@
# To remove generated files except the binary
clean:
-$(RM) $(OBJECTS)
# Remove generated files
extraclean:
-$(MAKE) clean
-$(RM) $(OUT)