From: Sebastien Bourdeauducq Date: Thu, 31 May 2012 18:17:33 +0000 (+0200) Subject: software: more flexible compilation target X-Git-Tag: 24jan2021_ls180~3141 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=20b137fce9a0b0bb86c9be00cb856ac2c1423dbf;p=litex.git software: more flexible compilation target --- diff --git a/software/bios/Makefile b/software/bios/Makefile index 4d4fcdd4..bfd0aafa 100644 --- a/software/bios/Makefile +++ b/software/bios/Makefile @@ -24,6 +24,9 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs -lbase -lcompiler_rt chmod -x $@ +%.o: %.c + $(compile-dep) + libs: make -C $(M2DIR)/software/libbase diff --git a/software/common.mak b/software/common.mak index 45dffd6d..046557a9 100644 --- a/software/common.mak +++ b/software/common.mak @@ -37,11 +37,12 @@ LDFLAGS = -nostdlib -nodefaultlibs # compile and generate dependencies, based on # http://scottmcpeak.com/autodepend/autodepend.html -%.o: $(SRCDIR)%.c - $(CC) -c $(CFLAGS) $(SRCDIR)$*.c -o $*.o - @$(CC_normal) -MM $(CFLAGS) $(SRCDIR)$*.c > $*.d - @mv -f $*.d $*.d.tmp - @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d - @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ - sed -e 's/^ *//' -e 's/$$/:/' >> $*.d - @rm -f $*.d.tmp +define compile-dep = +$(CC) -c $(CFLAGS) $< -o $*.o +@$(CC_normal) -MM $(CFLAGS) $< > $*.d +@mv -f $*.d $*.d.tmp +@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d +@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \ + sed -e 's/^ *//' -e 's/$$/:/' >> $*.d +@rm -f $*.d.tmp +endef diff --git a/software/libbase/Makefile b/software/libbase/Makefile index afa5650f..5c938db9 100644 --- a/software/libbase/Makefile +++ b/software/libbase/Makefile @@ -12,6 +12,9 @@ libbase.a: $(OBJECTS) $(AR) clr libbase.a $(OBJECTS) $(RANLIB) libbase.a +%.o: %.c + $(compile-dep) + .PHONY: clean clean: