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/$@
精彩评论