38 lines
797 B
Makefile
38 lines
797 B
Makefile
DIR_INC = ./include
|
|
DIR_SRC = ./src
|
|
DIR_OBJ = ./obj
|
|
DIR_BIN = ./bin
|
|
|
|
ABC_DIR = ./lib/abc
|
|
ABC_LIB_FILE = libabc.a
|
|
ABC_LIB_FLAGS = -L${ABC_DIR} -labc
|
|
|
|
SRC = $(wildcard ${DIR_SRC}/*.cpp)
|
|
OBJ = $(patsubst %.cpp,${DIR_OBJ}/%.o,$(notdir ${SRC}))
|
|
|
|
TARGET = dom
|
|
|
|
BIN_TARGET = ${DIR_BIN}/${TARGET}
|
|
|
|
CC = c++
|
|
|
|
CFLAGS = -O3 -std=c++1y -Wall -m64 -march=native -I${DIR_INC}
|
|
|
|
LDFLAGS = ${ABC_LIB_FLAGS} -lm -ldl -rdynamic -lreadline -ltermcap -lpthread
|
|
|
|
all:${BIN_TARGET}
|
|
|
|
${ABC_DIR}/${ABC_LIB_FILE}:
|
|
git submodule update --init ${ABC_DIR} && \
|
|
make -j -C ${ABC_DIR} ${ABC_LIB_FILE}
|
|
|
|
${BIN_TARGET}: ${OBJ} ${ABC_DIR}/${ABC_LIB_FILE}
|
|
$(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o $@
|
|
|
|
${DIR_OBJ}/%.o: ${DIR_SRC}/%.cpp
|
|
$(CC) $(CFLAGS) -c $^ -o $@
|
|
|
|
.PHONY:clean
|
|
clean:
|
|
find ${DIR_OBJ} -name "*.o" -exec rm -rf {} \;
|