2012-02-05 14:01:28 -05:00
|
|
|
M2DIR=../..
|
2012-05-24 13:02:59 -04:00
|
|
|
include $(M2DIR)/software/common.mak
|
2012-02-05 14:01:28 -05:00
|
|
|
|
2013-04-30 18:12:13 -04:00
|
|
|
OBJECTS=crt0.o isr.o sdram.o main.o boot-helper.o boot.o dataflow.o
|
2012-02-05 14:01:28 -05:00
|
|
|
|
|
|
|
all: bios.bin
|
|
|
|
|
|
|
|
# pull in dependency info for *existing* .o files
|
|
|
|
-include $(OBJECTS:.o=.d)
|
|
|
|
|
|
|
|
%.bin: %.elf
|
|
|
|
$(MAKE) -C $(M2DIR)/tools
|
|
|
|
$(OBJCOPY) -O binary $< $@
|
|
|
|
chmod -x $@
|
|
|
|
$(M2DIR)/tools/mkmmimg $@ write
|
|
|
|
|
|
|
|
bios.elf: linker.ld $(OBJECTS) libs
|
|
|
|
bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
|
|
|
|
|
|
|
|
%.elf:
|
2012-05-28 13:41:31 -04:00
|
|
|
$(LD) $(LDFLAGS) -T $< -N -o $@ $(OBJECTS) \
|
2013-04-30 18:12:13 -04:00
|
|
|
-L$(M2DIR)/software/libnet \
|
2012-05-28 13:41:31 -04:00
|
|
|
-L$(M2DIR)/software/libbase \
|
2013-01-10 11:59:00 -05:00
|
|
|
-L$(M2DIR)/software/libcompiler-rt \
|
2013-04-30 18:12:13 -04:00
|
|
|
-lnet -lbase -lcompiler-rt
|
2012-02-05 14:01:28 -05:00
|
|
|
chmod -x $@
|
|
|
|
|
2013-02-17 08:29:11 -05:00
|
|
|
main.o: main.c
|
|
|
|
$(compile-dep)
|
|
|
|
|
2012-05-31 14:17:33 -04:00
|
|
|
%.o: %.c
|
|
|
|
$(compile-dep)
|
|
|
|
|
2013-01-10 11:20:31 -05:00
|
|
|
%.o: %.S
|
|
|
|
$(assemble)
|
|
|
|
|
2012-02-05 14:01:28 -05:00
|
|
|
libs:
|
2013-05-10 16:30:28 -04:00
|
|
|
$(MAKE) -C $(M2DIR)/software/libcompiler-rt
|
|
|
|
$(MAKE) -C $(M2DIR)/software/libbase
|
|
|
|
$(MAKE) -C $(M2DIR)/software/libnet
|
2012-02-05 14:01:28 -05:00
|
|
|
|
2012-02-17 12:16:29 -05:00
|
|
|
flash: bios.bin
|
|
|
|
m1nor bios.bin
|
2012-02-05 14:01:28 -05:00
|
|
|
|
|
|
|
clean:
|
2013-05-10 16:30:28 -04:00
|
|
|
$(RM) $(OBJECTS) $(OBJECTS:.o=.d) bios.elf bios.bin bios-rescue.elf bios-rescue.bin .*~ *~
|
2012-02-17 12:16:29 -05:00
|
|
|
|
2013-05-10 16:30:28 -04:00
|
|
|
.PHONY: all main.o clean libs flash
|