开发者

makefile putting objs in separate directory

开发者 https://www.devze.com 2023-01-23 22:19 出处:网络
Why does $(OBJDIR)\\%.o:$(SRDDIR)\\%.s $(GCC) -c -g -I$(SRCDIR) $(ASFLAGS) $< -o $@ $(OBJDIR)\\%.o:$(SRDDIR)\\开发者_JS百科%.c

Why does

$(OBJDIR)\%.o:$(SRDDIR)\%.s
    $(GCC) -c -g -I$(SRCDIR) $(ASFLAGS) $< -o $@

$(OBJDIR)\%.o:$(SRDDIR)\开发者_JS百科%.c
    $(GCC) -c -g -I$(SRCDIR) $(CFLAGS) $< -o $@

gives warning (says ignoring the first rule) where as

%.o:%.s
    $(GCC) -c -g -I$(SRCDIR) $(ASFLAGS) $< -o $@

%.o:%.c
    $(GCC) -c -g -I$(SRCDIR) $(CFLAGS) $< -o $@

works fine but I will have all my sources and objs in the same directory. I would like to put the objs (generated from assembly files and c files) in a separate directory( and I am running make on windows).


Try using forward slashes ("/") instead of backward ones ("\").


The -o flag of GCC determines where the output file are made.

So this may work if you change:

%.o:%.s $(GCC) -c -g -I$(SRCDIR) $(ASFLAGS) $< -o $@

TO

%.o:%.s $(GCC) -c -g -I$(SRCDIR) $(ASFLAGS) $< -o myoutputdir/$@
0

精彩评论

暂无评论...
验证码 换一张
取 消