-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (38 loc) · 946 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
CPP = g++
FLAGS = -O5 -Wall -W
RM = rm -f -r
EXEC = a.out
CRDIR = createdir
INCLUDES = -Iincludes/
SRCPATH = classes
OBJDIR = build
OBJDIRFUNCTS = main
OBJDIRCLASSES = classes
CLASSES = \
course.o \
dept.o \
prof.o \
timetable.o \
FUNCTS = \
main.o \
function.o \
OBJECTS = \
$(addprefix $(OBJDIR)/$(OBJDIRFUNCTS)/, $(FUNCTS)) \
$(addprefix $(OBJDIR)/$(OBJDIRCLASSES)/, $(CLASSES)) \
all: $(OBJECTS) compile touch
$(OBJDIR)/$(OBJDIRFUNCTS)/%.o: %.cpp | $(CRDIR)/$(OBJDIR)/$(OBJDIRFUNCTS)
$(CPP) $(FLAGS) $(INCLUDES) -c $< -o $@
$(OBJDIR)/$(OBJDIRCLASSES)/%.o: $(SRCPATH)/%.cpp | $(CRDIR)/$(OBJDIR)/$(OBJDIRCLASSES)
$(CPP) $(FLAGS) $(INCLUDES) -c $< -o $@
$(CRDIR)/%:
mkdir -p $*
clean:
$(RM) $(OBJDIR) $(EXEC)
compile:
$(CPP) $(FLAGS) $(OBJECTS) -o $(EXEC)
run: | all
./$(EXEC)
touch:
@echo " "
@echo "Compilation done successfully..................."
@echo " "