-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·86 lines (61 loc) · 1.58 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
CC=g++
CFLAGS= -W -Wall -Wextra -pedantic -std=c99
CXX=g++
CXXFLAGS= -W -Wall -Wextra -pedantic -std=c++11
AS = nasm
ASFLAGS= -f elf64
#LDFLAGS= -lGL -lGLU -lglfw3 -lGLEW -lX11 -lXxf86vm -lXrandr -lpthread -lXi
LDFLAGS = -lblitz -lplplotcxxd -lgsl -lgslcblas
LDPOSTFLAGS=
DEBUGFLAGS= -g -O0
PROFILINGFLAGS= -O3 -pg
RELEASEFLAGS= -O3
SRCDIR = src/
OBJDIR = obj/
TARGET = main
EXT = c C cc cpp s S asm
SRC = $(notdir $(wildcard $(addprefix $(SRCDIR)*., $(EXT))))
OBJ = $(addprefix $(OBJDIR), $(addsuffix .o, $(basename $(SRC))))
all: $(TARGET)
debug: CFLAGS += $(DEBUGFLAGS)
debug: CXXFLAGS += $(DEBUGFLAGS)
debug: $(TARGET)
profile: CFLAGS += $(PROFILINGFLAGS)
profile: CXXFLAGS += $(PROFILINGFLAGS)
profile: $(TARGET)
release: CFLAGS += $(RELEASEFLAGS)
release: CXXFLAGS += $(RELEASEFLAGS)
release: $(TARGET)
$(TARGET): $(OBJ)
@echo
@echo
$(CXX) $^ $(LDFLAGS) -o $@ $(LDPOSTFLAGS) $(CXXFLAGS)
@echo
$(OBJDIR)%.o : $(SRCDIR)%.c
@echo
$(CC) -o $@ -c $^ $(CFLAGS)
$(OBJDIR)%.o : $(SRCDIR)%.C
@echo
$(CXX) $(INCLUDE) -o $@ -c $^ $(CXXFLAGS)
$(OBJDIR)%.o : $(SRCDIR)%.cc
@echo
$(CXX) $(INCLUDE) -o $@ -c $^ $(CXXFLAGS)
$(OBJDIR)%.o : $(SRCDIR)%.cpp
@echo
$(CXX) $(INCLUDE) -o $@ -c $^ $(CXXFLAGS)
$(OBJDIR)%.o : $(SRCDIR)%.s
@echo
$(AS) $(INCLUDE) -o $@ $^ $(ASFLAGS)
$(OBJDIR)%.o : $(SRCDIR)%.S
@echo
$(AS) $(INCLUDE) -o $@ $^ $(ASFLAGS)
$(OBJDIR)%.o : $(SRCDIR)%.asm
@echo
$(AS) $(INCLUDE) -o $@ $^ $(ASFLAGS)
# "-" pour enlever les messages d'erreurs
# "@" pour silent
.PHONY: clean cleanall
clean:
-@rm -rf $(OBJDIR)*.o
cleanall: clean
-@rm -f $(TARGET) $(TARGET).out