-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (38 loc) · 806 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
46
47
48
#Compiler
CC = clang
#Compiler flags
CFLAGS = -Wall -Wextra
# Source files
SOURCES = main.c \
flags/setFlags.c \
flags/checkFlags.c \
file/checkFileType.c \
get/getDir.c \
get/getFile.c \
str/strFileMode.c \
str/strFileTime.c \
str/strFileSize.c \
str/strFileName.c \
sort/sortArray.c \
print/printListing.c \
queue/dirQueue.c \
get/recurDir.c
OBJECTS = $(SOURCES:.c=.o)
# Libraries to link
LIBS = -lm
#output binary
BINARY=ls_midterm
all: $(BINARY)
#rule to link the binary
$(BINARY): $(OBJECTS)
$(CC) -o $@ $(OBJECTS) $(LIBS)
#rule to compile source files into object files
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: clean
clean:
rm -rf $(BINARY) $(OBJECTS)
#clean only the object files
.PHONY: clean-obj
clean-obj:
rm -rf $(OBJECTS)