-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·45 lines (33 loc) · 774 Bytes
/
Makefile
File metadata and controls
executable file
·45 lines (33 loc) · 774 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
# Set compiler to g++, unless it is already set.
CXX ?= g++
# Flags
CXXFLAGS += -Wall -Wextra
ifeq ($(DEBUG),1)
CXXFLAGS += -g -O0
LDFLAGS += -g
else
CXXFLAGS += -O3
endif
# Useful for building a Windows executable.
ifeq ($(STATIC),1)
LDFLAGS += -static -static-libstdc++
endif
# Define what extensions we use
.SUFFIXES : .cpp
.PHONY: clean all
# Name of executable
PROG_NAME = duplo
# List of object files
OBJS = StringUtil.o HashUtil.o TextFile.o FileType.o \
SourceFile.o SourceLine.o Duplo.o main.o
# Build process
all: ${PROG_NAME}
# Link
${PROG_NAME}: ${OBJS}
${CXX} ${LDFLAGS} -o ${PROG_NAME} ${OBJS}
# Each .cpp file compile
.cpp.o:
${CXX} ${CXXFLAGS} -c $*.cpp -o$@
# Remove all object files and the executable
clean:
rm -f *.o duplo