MinGW 比较通用的Makefile_C/C++_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > C/C++ > MinGW 比较通用的Makefile

MinGW 比较通用的Makefile

 2010/12/4 11:51:52  chenqi210  http://chenqi210.javaeye.com  我要评论(0)
  • 摘要:#MinGW5.1.6.PHONY:cleandependalltidyrebuildCC=C:\MinGW\bin\g++.exeRM=del/fFLAGS=-g-Wall-O3#-save-temps#-fdump-class-hierarchy#-dump_class_hierarchyLIBPATHS=-L"C:\MingW\lib"LIBS=#-lopengl32#-mwindowsSRC+=$(wildcard*.cpp)SRC+=$(wildcard*/*.cpp)SRC+=$
  • 标签:file Make

#MinGW 5.1.6
.PHONY:clean depend all tidy rebuild
CC = C:\MinGW\bin\g++.exe
RM = del /f
FLAGS = -g -Wall -O3 #-save-temps #-fdump-class-hierarchy #-dump_class_hierarchy
LIBPATHS = -L"C:\MingW\lib"
LIBS = #-lopengl32 #-mwindows
SRC += $(wildcard *.cpp)
SRC += $(wildcard */*.cpp)
SRC += $(wildcard */*/*.cpp)
SRC += $(wildcard */*/*/*.cpp)
SRC += $(wildcard */*/*/*/*.cpp)
SRC += $(wildcard */*/*/*/*/*.cpp)
SRC += $(wildcard */*/*/*/*/*/*.cpp)
SRC += $(wildcard */*/*/*/*/*/*/*.cpp)
SRC += $(wildcard */*/*/*/*/*/*/*/*.cpp)
OBJ = $(patsubst %.cpp,%.o,$(SRC))
DEP = $(patsubst %.cpp,%.d,$(SRC))
BIN = $(notdir $(CURDIR).exe)
all:$(BIN)
rebuild: all tidy
$(BIN):$(OBJ)
[TAB]$(CC) $(FLAGS) $^ $(LIBPATHS) $(LIBS) -o $@
-include $(DEP)
clean:
[TAB]-$(RM) $(subst /,\,$(BIN)) $(subst /,\,$(OBJ)) $(subst /,\,$(DEP))
tidy:
[TAB]-$(RM) $(subst /,\,$(OBJ)) $(subst /,\,$(DEP))
$(DEP):%.d:%.cpp
[TAB]${CC} -MM -MT $(patsubst %.cpp,%.o,$(^)) $(^) > $@
[TAB]@echo $$(CC) $$(FLAGS) -c -o $$@ $$(filter %%.cpp,$$^^) >> $@

?

注意:自己将[TAB]替换为Tab字符

发表评论
用户名: 匿名