我是一个非常新的makefile,我想使用makefile创建目录.我的项目目录是这样的
+--Project
+--output
+--source
+Testfile.cpp
+Makefile
Run Code Online (Sandbox Code Playgroud)
我想将所有对象和输出放入相应的输出文件夹中.我想创建文件夹结构,编译后就像这样.
+--Project
+--output
+--debug (or release)
+--objs
+Testfile.o
+Testfile (my executable file)
+--source
+Testfile.cpp
+Makefile
Run Code Online (Sandbox Code Playgroud)
我尝试了几种选择,但无法成功.请帮我用make文件制作目录.我发布了Makefile供你考虑.
#---------------------------------------------------------------------
# Input dirs, names, files
#---------------------------------------------------------------------
OUTPUT_ROOT := output/
TITLE_NAME := TestProj
ifdef DEBUG
TITLE_NAME += _DEBUG
else
ifdef RELEASE
TITLE_NAME += _RELEASE
endif
endif
# Include all the source files here with the directory tree
SOURCES := \
source/TestFile.cpp \
#---------------------------------------------------------------------
# configs
#---------------------------------------------------------------------
ifdef DEBUG
OUT_DIR := $(OUTPUT_ROOT)debug
CC_FLAGS := -c -Wall
else
ifdef RELEASE …Run Code Online (Sandbox Code Playgroud)