-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (35 loc) · 1.23 KB
/
Makefile
File metadata and controls
48 lines (35 loc) · 1.23 KB
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
TARGET := main
SOURCE := \
example.cpp
INCS :=
LIBS := -lpthread
DEFINES := --std=c++11
CXXFLAGS := -O2 -fPIC -Wall -Wextra
LDFLAGS := -fPIC
#****************************************************************************
# Makefile code common to all platforms
#****************************************************************************
CXXFLAGS := ${CXXFLAGS} ${DEFINES}
OBJECT := $(addsuffix .o,$(basename ${SOURCE}))
#****************************************************************************
# Compile block
#****************************************************************************
all: ${TARGET}
${TARGET}: ${OBJECT}
${CXX} ${LDFLAGS} -o ${TARGET} ${OBJECT} ${LIBS}
install:
${STRIP} ${TARGET}
install -m 755 ${TARGET} ${INSTALL_DIR}/bin
#****************************************************************************
# common rules
#****************************************************************************
%.o : %.cpp
${CXX} ${CXXFLAGS} ${INCS} -c $< -o $@
%.o : %.cc
${CXX} ${CXXFLAGS} ${INCS} -c $< -o $@
#****************************************************************************
# Depend block
#****************************************************************************
depend:
clean:
rm -f core ${OBJECT} ${TARGET}