#表示注释my1.exe ;;; 表示最终要生成的文件 my1.obj: my1.cpp ;;如果cpp文件比obj文件新,就编译 [空一个TAB]cl 加编译参数,连接库等 #///////////////# Makefile : Illustrates the effective use of precompiled # headers in a project # Usage: NMAKE option # option: DEBUG=[0|1] # (DEBUG not defined is equivalent to DEBUG=0) # OBJS = myapp.obj applib.obj # List all stable header files in the STABLEHDRS macro. STABLEHDRS = stable.h another.h # List the final header file to be precompiled here: BOUNDRY = stable.h # List header files under development here: UNSTABLEHDRS = unstable.h # List all compiler options common to both debug and final # versions of your code here: CLFLAGS = /c /W3 # List all linker options common to both debug and final # versions of your code here: LINKFLAGS = /NOD /ONERROR:NOEXE !IF "$(DEBUG)" == "1" CLFLAGS = /D_DEBUG $(CLFLAGS) /Od /Zi /f LINKFLAGS = $(LINKFLAGS) /COD LIBS = slibce !ELSE CLFLAGS = $(CLFLAGS) /Oselg /Gs LINKFLAGS = $(LINKFLAGS) LIBS = slibce !ENDIF #要产生的exe文件 myapp.exe: $(OBJS) link $(LINKFLAGS) @<< $(OBJS), myapp, NUL, $(LIBS), NUL; << # Compile myapp #编译myapp.cpp产生myapp.obj myapp.obj : myapp.cpp $(UNSTABLEHDRS) stable.pch $(CPP) $(CLFLAGS) /Yu$(BOUNDRY) myapp.cpp # Compile applib applib.obj : applib.cpp $(UNSTABLEHDRS) stable.pch $(CPP) $(CLFLAGS) /Yu$(BOUNDRY) applib.cpp # Compile headers stable.pch : $(STABLEHDRS) $(CPP) $(CLFLAGS) /Yc$(BOUNDRY) applib.cpp myapp.cpp
我要多一点
不过在使用nmake前,最好先执行vcvars32.bat(在VC98\bin下);
可将VCVars32.bat 写入Autoexec.bat里....
my1.obj: my1.cpp ;;如果cpp文件比obj文件新,就编译
[空一个TAB]cl 加编译参数,连接库等
#///////////////# Makefile : Illustrates the effective use of precompiled
# headers in a project
# Usage: NMAKE option
# option: DEBUG=[0|1]
# (DEBUG not defined is equivalent to DEBUG=0)
#
OBJS = myapp.obj applib.obj
# List all stable header files in the STABLEHDRS macro.
STABLEHDRS = stable.h another.h
# List the final header file to be precompiled here:
BOUNDRY = stable.h
# List header files under development here:
UNSTABLEHDRS = unstable.h
# List all compiler options common to both debug and final
# versions of your code here:
CLFLAGS = /c /W3
# List all linker options common to both debug and final
# versions of your code here:
LINKFLAGS = /NOD /ONERROR:NOEXE
!IF "$(DEBUG)" == "1"
CLFLAGS = /D_DEBUG $(CLFLAGS) /Od /Zi /f
LINKFLAGS = $(LINKFLAGS) /COD
LIBS = slibce
!ELSE
CLFLAGS = $(CLFLAGS) /Oselg /Gs
LINKFLAGS = $(LINKFLAGS)
LIBS = slibce
!ENDIF
#要产生的exe文件
myapp.exe: $(OBJS)
link $(LINKFLAGS) @<<
$(OBJS), myapp, NUL, $(LIBS), NUL;
<<
# Compile myapp
#编译myapp.cpp产生myapp.obj
myapp.obj : myapp.cpp $(UNSTABLEHDRS) stable.pch
$(CPP) $(CLFLAGS) /Yu$(BOUNDRY) myapp.cpp
# Compile applib
applib.obj : applib.cpp $(UNSTABLEHDRS) stable.pch
$(CPP) $(CLFLAGS) /Yu$(BOUNDRY) applib.cpp
# Compile headers
stable.pch : $(STABLEHDRS)
$(CPP) $(CLFLAGS) /Yc$(BOUNDRY) applib.cpp myapp.cpp
给个简单的看看,比较清楚all: man0 //生成man0.out可执行文件
.c.o:
cc -c $*.c //将所有.c文件编译为.o(相当.obj)
.SUFFIXES: .o .cman0: cardman0.o
cc -s -O -oman0 -dy z_com.a -lsocket
//cc (相当cl) 各种参数,目标文件名(man0),库文件(.a)
To kingfish(今飞) :那里有MAKEFILE的文挡
MSDN上有一些
Must use them, So I have to know something about itThanks, Then adding the score
add score later