From 11e35f05894557776a88115b6dd1205aa9e7ccd7 Mon Sep 17 00:00:00 2001 From: ichdream Date: Mon, 30 Aug 2021 21:57:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=B7=A5=E5=85=B7=E9=85=8D=E7=BD=AEMakefile=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01.SimpleFactory/2.Code/Makefile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 01.SimpleFactory/2.Code/Makefile diff --git a/01.SimpleFactory/2.Code/Makefile b/01.SimpleFactory/2.Code/Makefile new file mode 100644 index 0000000..ce492a8 --- /dev/null +++ b/01.SimpleFactory/2.Code/Makefile @@ -0,0 +1,29 @@ +DIR_INC = ./ +DIR_SRC = ./ +DIR_OBJ = ./obj +DIR_BIN = ./bin + +SRC = $(wildcard ${DIR_SRC}/*.cpp) +OBJ = $(patsubst %.cpp,${DIR_OBJ}/%.o,$(notdir ${SRC})) + +TARGET = main + +BIN_TARGET = ${DIR_BIN}/${TARGET} + +CC = g++ +CFLAGS = -g -Wall -I${DIR_INC} + + +${BIN_TARGET}:${OBJ} + mkdir -p $(DIR_BIN) + $(CC) $(OBJ) -o $@ + +${DIR_OBJ}/%.o:${DIR_SRC}/%.cpp + mkdir -p $(DIR_OBJ) + $(CC) $(CFLAGS) -c $< -o $@ + +.PHONY:clean + +clean: + rm -rf bin obj + rm -rf ./main \ No newline at end of file