Makefile won't copy .o to obj/ and target to bin/ folders

Posted by about blank on Stack Overflow See other posts from Stack Overflow or by about blank
Published on 2012-09-29T01:17:49Z Indexed on 2012/09/29 3:37 UTC
Read the original article Hit count: 131

Filed under:
|
|
|
|

I'm trying to write a Makefile which will copy its target and objects to bin/ and obj/ directories, respectively.

Yet, when I try to run it I get the following error:

nasm -f elf64 -g -F stabs main.asm -l spacelander.lst
ld -o spacelander obj/main.o
ld: cannot find obj/main.o: No such file or directory
make: *** [spacelander] Error 1
Why is this happening?

Update

I noticed when I posted the error that it was due to white spacing errors. After taking care of those, I still get the new error I replaced with the old one I mentioned prior.

What is this??

Update 2

Posted -d flag output below Makefile source.


Source

ASM  := nasm
ARGS := -f
FMT  := elf64
OPT  := -g -F stabs

SRC    := main.asm

OBJDIR := obj 
TARGETDIR := bin

OBJ    := $(addprefix $(OBJDIR)/,$(patsubst %.asm, %.o, $(wildcard *.asm)))
TARGET := spacelander

.PHONY: all clean

all: $(OBJDIR) $(TARGET)

$(OBJDIR): 
    mkdir $(OBJDIR)

$(OBJDIR)/%.o: $(SRC)
    $(ASM) $(ARGS) $(FMT) $(OPT) $(SRC) -l $(TARGET).lst

$(TARGET): $(OBJ)
    ld -o $(TARGET) $(OBJ)

clean:
    @rm -f $(TARGET) $(wildcard *.o)
    @rm -rf $(OBJDIR)

make -d Output - NOTE: output is too many characters for body, thus is pastebinned

http://pastebin.com/3bctGJxs

© Stack Overflow or respective owner

Related posts about makefile

Related posts about executable