-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (35 loc) · 875 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
##
## EPITECH PROJECT, 2019
## Makefile
## File description:
## make an executable
##
CC = g++
EXECUTABLE = main
SRC_DIR = src
SRC = $(shell find $(SRC_DIR) -name '*.cpp')
OBJ = $(SRC:%.cpp=%.o)
CFLAGS += -std=c++17 -W -Wall -Wextra $(if $(DEBUG),-g3) $(if $(DEBUG),-DDEBUG)
LDFLAGS = -ldl
INC_FLAGS = -Iinclude
all: bin/$(EXECUTABLE)
run: all
@./bin/$(EXECUTABLE) $(ARGS)
bin/$(EXECUTABLE): $(OBJ)
@$(CC) -o $@ $(OBJ) $(CFLAGS) $(INC_FLAGS) $(LDFLAGS)
%.o: %.cpp
@$(CC) $(INC_FLAGS) $(CFLAGS) -c $< -o $@
@echo "\033[1;32mCompiled \033[1;37m'$<'\033[m"
.PHONY: clean
clean:
@$(RM) -r $(OBJ)
.PHONY: fclean
fclean: clean
@$(RM) -r $(BIN)/$(EXECUTABLE)
@$(RM) -r vgcore*
.PHONY: re
re: fclean all
valgrind:
valgrind --leak-check=full -s ./bin/$(EXECUTABLE) $(ARGS)
dll:
@g++ -g3 -Wall -Wno-write-strings -g -fPIC -shared -I include ./Test.cpp -o test.so