#MinGW 5.1.6
.PHONY:clean tidy rebuild
SRCDIR = src
LIBDIR = lib
DOCSDIR = docs
BUILDDIR = build
CC = C:\MinGW\bin\g++.exe
SRCEXT = cpp
DEPEXT = depend
RM = del /f /q
MKDIR = mkdir
RMDIR = rmdir /q /s
FLAGS = -g -Wall -O3 #-save-temps #-fdump-class-hierarchy #-dump_class_hierarchy
LIBPATHS = -L"C:\MingW\lib" -L"${LIBDIR}"
LIBS = #-lopengl32 #-mwindows
SRCT = *.${SRCEXT}
SRCS += ${SRCT}
SRCS += */${SRCT}
SRCS += */*/${SRCT}
SRCS += */*/*/${SRCT}
SRCS += */*/*/*/${SRCT}
SRCS += */*/*/*/*/${SRCT}
SRC = ${wildcard ${addprefix ${SRCDIR}/,${SRCS}}}
OBJ = ${patsubst ${SRCDIR}/%.${SRCEXT},${BUILDDIR}/%.o,${SRC}}
DEP = ${patsubst ${SRCDIR}/%.${SRCEXT},${BUILDDIR}/%.${DEPEXT},${SRC}}
BIN = ${BUILDDIR}/${notdir ${CURDIR}.exe}
build: ${BIN}
rebuild: tidy build
${BIN}: ${OBJ}
@echo make target: ${BIN}
@${CC} ${FLAGS} $^ ${LIBPATHS} ${LIBS} -o $@
prepare:
@echo prepare folders
@if not exist ${BUILDDIR} (${MKDIR} ${BUILDDIR} && @echo make director
MinGW 比较通用的Makefile
最新推荐文章于 2025-04-18 09:52:06 发布
本文详细介绍了如何在MinGW环境下编写和使用通用的Makefile,包括编译规则、依赖管理和目标设置等方面,帮助开发者高效组织C/C++项目。

最低0.47元/天 解锁文章
4359

被折叠的 条评论
为什么被折叠?



