32 summarizes a compilation of code at the makefile

Since the 32-bit assembly language requires nmake command language compiler to compile, link, it is necessary to specify the compile and link the sequence, so that the compiler can know how to compile each source file and generate corresponding compilation links, some documents described in the syntax to write, so it is necessary to grasp the wording of the makefile (makefile file in the same folder in assembly language)
about configuring the compilation environment I look at another blog https://blog.csdn.net/znevegiveup1/article/details / 104 073 948
where the wording of the makefile divided into several categories
1. only a simple asm file, this file write the makefile

#这里指定要编译文件的asm名称为hello
NAME = Hello
OBJS = $(NAME).obj#输出的obj文件的名称也为hello

#下面两句为固定写法
LINK_FLAG = /subsystem:windows	#链接选项
ML_FLAG = /c /coff				#编译选项

#定义依赖关系,.exe只需由objs文件生成
$(NAME).exe: $(OBJS)
	Link $(LINK_FLAG) $(OBJS)

#定义汇编编译和资源编译的默认规则
.asm.obj:
	ml $(ML_FLAG) $<

#清除临时文件
clean:
	del *.obj

2. Examples of required resources rc file

EXE = Test.exe		#指定输出文件
OBJS = Test.obj		#需要的目标文件
RES = Test.res		#需要的资源文件

LINK_FLAG = /subsystem:windows	#连接选项
ML_FLAG = /c /coff		#编译选项

$(EXE): $(OBJS) $(RES)
	Link $(LINK_FLAG) $(OBJS) $(RES)

.asm.obj:
	ml $(ML_FLAG) $<
.rc.res:
	rc $<

clean:
	del *.obj
	del *.res
Published 19 original articles · won praise 7 · views 3094

Guess you like

Origin blog.csdn.net/znevegiveup1/article/details/104076017