我有一个包含makefile的项目:
# a simple makefile
# Uncomment, if compression support is desired
#DCOMP=-DWITH_COMPRESSION
#ZLIB=-lz
#Compiler
CC=g++
# compiler switches
#CPPFLAGS=-g -I.
CPPFLAGS=-O -I.
CFLAGS=-O -I. $(DCOMP)
#LDFLAGS=-L/usr/local/lib
#libraries
LIBS= -lm $(ZLIB)
# Compilation rules
# target:source
%.o:%.c
$(CC) $(CFLAGS) -o $@ -c $<
%.o:%.cpp
$(CC) $(CPPFLAGS) -o $@ -c $<
# $@-target, $<-source
DNAME=f3dProjBasicNoComp12
PROGRAM=project
PROJ_OBJECTS= project.o f3d.o f3dGridLite.o
#the first (default)
all:$(PROGRAM)
project:$(PROJ_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $(PROJ_OBJECTS) $(LIBS)
clean:
rm -f $(PROGRAM) *.o core* *.ppm
pack:
make clean
(cd .. && tar cvzf $(DNAME).tgz $(DNAME))
我已经安装了cygwin和mingw,但我无法编译make文件或运行项目:(我总是得到错误: 第一:
C:\Users\Bladeszasza>C:\MinGW\bin\mingw32-make.exe -B C:\Users\Bladeszasza\Docu
ments\vvd\f3dProjBasicNoComp12\Makefile
mingw32-make: Nothing to be done for `C:\Users\Bladeszasza\Documents\vvd\f3dProj
BasicNoComp12\Makefile'.
C:\Users\Bladeszasza>C:\MinGW\bin\mingw32-make.exe -B C:\Users\Bladeszasza\Docu
ments\vvd\f3dProjBasicNoComp12\Makefile
C;\MinGW\bin\mingw32-make: invalid option --z
Usage : mingw32-make [option] [target] ...
Options:
所以我需要运行名为project.cpp的项目 但我不知道该怎么办&gt;( 请帮帮我
感谢
答案 0 :(得分:1)
Make必须像this一样使用:
make [ -f makefile ] [ options ] ... [ targets ] ...
-B
用于始终构建
-B, --always-make
Unconditionally make all targets.
所以当你输入:
mingw32-make.exe -B C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile
-f
-B
C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile
是目标。您需要做的是:
mingw32-make.exe -f C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile -B all