software/common.mak: support changing source directory

This commit is contained in:
Sebastien Bourdeauducq 2012-05-25 22:29:15 +02:00
parent 598498ec2b
commit d66835d3ab
1 changed files with 3 additions and 3 deletions

View File

@ -44,9 +44,9 @@ LDFLAGS = -nostdlib -nodefaultlibs
# compile and generate dependencies, based on # compile and generate dependencies, based on
# http://scottmcpeak.com/autodepend/autodepend.html # http://scottmcpeak.com/autodepend/autodepend.html
%.o: %.c %.o: $(SRCDIR)%.c
$(CC) -c $(CFLAGS) $*.c -o $*.o $(CC) -c $(CFLAGS) $(SRCDIR)$*.c -o $*.o
@$(CC_normal) -MM $(CFLAGS) $*.c > $*.d @$(CC_normal) -MM $(CFLAGS) $(SRCDIR)$*.c > $*.d
@mv -f $*.d $*.d.tmp @mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \