-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
43 lines (31 loc) · 832 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
PROJ_NAME=min-cut
#.hpp files
HPP_SOURCE=$(wildcard ./include/*.hpp ./include/utils/*.hpp)
# .cpp files
CPP_SOURCE=$(wildcard ./src/*.cpp ./src/utils/*.cpp)
# Object files
OBJ=$(CPP_SOURCE:.c=.o)
# compiler and linker
CXX=g++
#compiler's flags
CXXFLAGS= -Wall -Wextra --std=c++23 -g
all: $(PROJ_NAME)
$(PROJ_NAME): $(OBJ)
@ echo 'Building binary using G++ linker: $@'
$(CXX) $^ -o $@
@ echo 'Finished building binary: $@'
@ echo ' '
./objects/%.o: ./src/%.cpp ininclude/%.hpp
@ echo 'Building target using G++ compiler: $<'
$(CXX) $< $(CXXFLAGS) -o $@
@ echo ' '
./objects/main.o: ./src/main.cpp $(HPP_SOURCE)
@ echo 'Building target using G++ compiler: $<'
$(CXX) $< $(CXXFLAGS) -o $@
@ echo ' '
objFolder:
@ mkdir -p objects
clean:
@ $(RM) ./objects/*.o $(PROJ_NAME) *~
@ rmdir objects
.PHONY: all clean