我的Makefile问题。没有相应的文件和目录

时间:2016-04-16 01:31:09

标签: makefile mips

我正在尝试使用Make构建MIPS程序。我有两个非常简单的文件,因为我想在继续使用功能之前让Makefile工作:

 logic.asm
 # contains a main method
 # contains a .globl to print_strings
 # calls print_strings

 printer.asm
 # has a print_strings method that just prints a few strings and returns

我的Makefile看起来像这样:

RASM = /home/bin/rasm
RLINK = /home/bin/rlink

# Suffixes
.SUFFIXES:    .asm .obj .lst .out

# Obj files
OBJS = logic.obj printer.obj

# ASM -> OBJ
.asm.obj:
        $(RASM) -l $*.asm > $*.lst

# OBJ -> OUT
.obj.out:
        $(RLINK) -m -o $*.out $*.obj > $*.map

 # target
 logic.out:        $(OBJS)
          $(RLINK) -m -o $*.out $*.out $(OBJS) > $*.map

当我运行make时,这就是我所看到的:

$ make
/home/bin/rlink -m -o logic.out logic.out logic.obj printer.obj > logic.map
logic.out: No such file or directory
make: *** [logic.out] Error 1

1 个答案:

答案 0 :(得分:0)

问题在于这一行:

$(RLINK) -m -o $*.out $*.out $(OBJS) > $*.map

应该只有1 $ *。out,就像这样:

$(RLINK) -m -o $*.out $(OBJS) > $*.map