在windows中使用make使用dev-cpp來構建環境是很方便的。
下載安裝dev-cpp在環境變數中新增dev-cpp的安裝路徑就可以自己編寫makefile檔案在dos模擬終端運行了。
dev-cpp自動生成的makefile檔案如下:
# Project: BinaryTree
# Makefile created by Dev-C++ 4.9.9.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = main.o $(RES)
LINKOBJ = main.o $(RES)
LIBS = -L"C:/Program Files/DEV-CPP/Lib"
INCS = -I"C:/Program Files/DEV-CPP/include"
CXXINCS = -I"C:/Program Files/DEV-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/backward" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/mingw32" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2" -I"C:/Program Files/DEV-CPP/include"
BIN = BinaryTree.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before BinaryTree.exe all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o "BinaryTree.exe" $(LIBS)
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
改進
BIN = ScanfTest.exe
SRC += ScanfTest.c
OBJ = $(SRC:.c=.o) $(RES)
LINKOBJ = $(OBJ) $(RES)
all: all-before $(BIN) all-after
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)
在windows中使用make使用dev-cpp來構建環境是很方便的。
下載安裝dev-cpp在環境變數中新增dev-cpp的安裝路徑就可以自己編寫makefile檔案在dos模擬終端運行了。
dev-cpp自動生成的makefile檔案如下:
# Project: BinaryTree
# Makefile created by Dev-C++ 4.9.9.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = main.o $(RES)
LINKOBJ = main.o $(RES)
LIBS = -L"C:/Program Files/DEV-CPP/Lib"
INCS = -I"C:/Program Files/DEV-CPP/include"
CXXINCS = -I"C:/Program Files/DEV-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/backward" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/mingw32" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2" -I"C:/Program Files/DEV-CPP/include"
BIN = BinaryTree.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before BinaryTree.exe all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o "BinaryTree.exe" $(LIBS)
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
改進
# Project: BinaryTree
# Makefile created by Dev-C++ 4.9.9.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
BIN = ScanfTest.exe
RES =
SRC += ScanfTest.c
OBJ = $(SRC:.c=.o) $(RES)
LINKOBJ = $(OBJ) $(RES)
LIBS = -L"C:/Program Files/DEV-CPP/Lib"
INCS = -I"C:/Program Files/DEV-CPP/include"
CXXINCS = -I"C:/Program Files/DEV-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/backward" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2/mingw32" -I"C:/Program Files/DEV-CPP/include/c++/3.4.2" -I"C:/Program Files/DEV-CPP/include"
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before $(BIN) all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)