[Milkymist-devel] [PATCH] connect the dependency between softusb and libhal, add libs dependency to bios

Xiangfu Liu xiangfu at sharism.cc
Mon Nov 21 19:36:47 PST 2011


Signed-off-by: Xiangfu Liu <xiangfu at sharism.cc>
---
 softusb-input/Makefile   |    2 +-
 software/bios/Makefile   |   18 ++++++++++++++++--
 software/libhal/Makefile |    5 ++---
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/softusb-input/Makefile b/softusb-input/Makefile
index 54a9e98..a08cdbe 100644
--- a/softusb-input/Makefile
+++ b/softusb-input/Makefile
@@ -5,7 +5,7 @@ all: softusb-input.bin
 %.bin: %.elf
 	avr-objcopy -O binary $< $@
 
-softusb-input.elf: $(SOURCES)
+softusb-input.elf: $(SOURCES) $(wildcard *.h)
 	avr-gcc -o softusb-input.elf -mmcu=avr2 -mno-interrupts -Wall -Os $(SOURCES) $(CFLAGS) -nostdlib -Wl,-T -Wl,navre.ld
 
 .PHONY: clean
diff --git a/software/bios/Makefile b/software/bios/Makefile
index 1ba8e4a..b885723 100644
--- a/software/bios/Makefile
+++ b/software/bios/Makefile
@@ -3,6 +3,8 @@ include $(MMDIR)/software/include.mak
 
 OBJECTS=crt0.o isr.o main.o unlzma.o boot.o boot-helper.o splash.o
 SEGMENTS=-j .text -j .data -j .rodata
+LIBS=$(MMDIR)/software/libhpdmc/libhpdmc.a $(MMDIR)/software/libbase/libbase-light.a \
+     $(MMDIR)/software/libhal/libhal.a     $(MMDIR)/software/libnet/libnet.a
 
 all: bios.bin bios-rescue.bin
 
@@ -13,13 +15,25 @@ all: bios.bin bios-rescue.bin
 	$(MMDIR)/tools/mkmmimg $@ write
 
 # make sure the linker*.ld at the first of depends
-bios.elf: linker.ld $(OBJECTS)
-bios-rescue.elf: linker-rescue.ld $(OBJECTS)
+bios.elf: linker.ld $(OBJECTS) $(wildcard *.h) $(LIBS)
+bios-rescue.elf: linker-rescue.ld $(OBJECTS) $(wildcard *.h) $(LIBS)
 
 %.elf:
 	$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) -L$(MMDIR)/software/libhpdmc -L$(MMDIR)/software/libbase -L$(MMDIR)/software/libhal -L$(MMDIR)/software/libnet --start-group -lhpdmc -lbase-light -lhal -lnet --end-group
 	chmod -x $@
 
+$(MMDIR)/software/libhpdmc/libhpdmc.a:
+	make -C $(MMDIR)/software/libhpdmc/
+
+$(MMDIR)/software/libbase/libbase-light.a:
+	make -C $(MMDIR)/software/libbase/
+
+$(MMDIR)/software/libhal/libhal.a:
+	make -C $(MMDIR)/software/libhal/
+
+$(MMDIR)/software/libnet/libnet.a:
+	make -C $(MMDIR)/software/libnet/
+
 .PHONY: clean depend
 
 depend:
diff --git a/software/libhal/Makefile b/software/libhal/Makefile
index ea2522c..a33fb9c 100644
--- a/software/libhal/Makefile
+++ b/software/libhal/Makefile
@@ -5,7 +5,7 @@ OBJECTS=brd.o dmx.o font8x16.o mem.o pfpu.o snd.o time.o tmu.o ukb.o usb.o vga.o
 
 all: libhal.a
 
-libhal.a: $(OBJECTS)
+libhal.a: $(OBJECTS) softusb-input.h
 	$(AR) clr libhal.a $(OBJECTS)
 	$(RANLIB) libhal.a
 
@@ -13,10 +13,9 @@ $(MMDIR)/softusb-input/softusb-input.bin:
 	$(MAKE) -C $(MMDIR)/softusb-input
 
 softusb-input.h: $(MMDIR)/softusb-input/softusb-input.bin
-	$(MAKE) -C $(MMDIR)/softusb-input
 	cat $(MMDIR)/softusb-input/softusb-input.bin | xxd -i - softusb-input.h
 
-.PHONY: clean depend
+.PHONY: clean depend $(MMDIR)/softusb-input/softusb-input.bin
 
 depend: softusb-input.h
 	makedepend -Y -- $(CFLAGS) -- *.c
-- 
1.7.4.1



More information about the Devel mailing list