-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
39 lines (33 loc) · 774 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
#-----------------------#
# Configuration Section #
#-----------------------#
flags = -Wall -Wextra -g
srcDir = source
headDir = header
lib = -lm -lpthread
project_name = project_name
.PHONY: clean $(project_name)
#---------------------#
# Rules for compiling #
#---------------------#
$(project_name): main.o lib.o clean
gcc $(flags) -o $@ main.o lib.o $(lib)
chmod 775 $@
main.o: $(srcDir)/main.c
gcc $(flags) -c $^ $(lib)
lib.o: $(srcDir)/lib.c $(headDir)/lib.h
gcc $(flags) -c $^ $(lib)
#--------------------#
# Rules for cleaning #
#--------------------#
clean:
rm -rf $(srcDir)/*bak*
rm -rf *bak*
rm -rf $(srcDir)/*~
rm -rf *~
rm -rf $(srcDir)/core
rm -rf core
distclean: clean
rm -rf $(project_name)
rm -rf *.o
rm -rf $(headDir)/*.gch