-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (35 loc) · 934 Bytes
/
Copy pathMakefile
File metadata and controls
45 lines (35 loc) · 934 Bytes
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
TARGET = pauc
CXX = clang++
# compiling flags here
CXXFLAGS = -O3 -std=c++14 -Wall -I.
LINKER = $(CXX) -o
# linking flags here
LFLAGS = -Wall -I. -lm -pthread
# change these to set the proper directories where each files shoould be
SRCDIR = src
OBJDIR = obj
BINDIR = bin
INCDIR = include
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
INCLUDES := $(wildcard $(INCDIR)/*.hpp)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
rm = rm -f
# useful for debugging and profiling
ifeq ($(PROFILE), 1)
CXXFLAGS += -g -O0
endif
# use g++ instead
ifeq ($(GCC), 1)
CXX = g++
endif
$(BINDIR)/$(TARGET): $(OBJECTS)
@$(LINKER) $@ $(LFLAGS) $(OBJECTS)
@echo "Linking complete!"
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp
@$(CXX) $(CXXFLAGS) -c $< -o $@
@echo "Compiled "$<" successfully!"
.PHONEY: clean
clean:
@$(rm) $(OBJECTS)
@$(rm) $(BINDIR)/$(TARGET)
@echo "Cleanup complete!"