1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-19 10:19:42 +02:00

atusb/fw/Makefile: introduce target-specific compliation variants

- Makefile (USB_OBJS): moved into OBJS and BOOT_OBJS
- Makefile (OBJS): atu2.o is now app-atu2.o
- Makefile (BOOT_OBJS): atu2.o is now boot-atu2.o
- Makefile (MKDEP, %.o): moved dependency generation to macro $(MKDEP)
- Makefile (app-%.o): build from usb/%.c
- Makefile (boot -%.o): build from usb/%.c and set -DBOOT_LOADER
This commit is contained in:
Werner Almesberger 2011-06-26 06:56:01 -03:00
parent 0194dc1a05
commit 6909fc232a

View File

@ -30,11 +30,10 @@ SIZE = $(AVR_PREFIX)size
USB_ID = 20b7:1540 USB_ID = 20b7:1540
USB_OBJS = usb.o atu2.o OBJS = atusb.o board.o board_app.o sernum.o spi.o descr.o ep0.o \
OBJS = atusb.o board.o board_app.o sernum.o spi.o descr.o ep0.o dfu_common.o \ dfu_common.o usb.o app-atu2.o
$(USB_OBJS) BOOT_OBJS = boot.o board.o sernum.o spi.o flash.o dfu.o \
BOOT_OBJS = boot.o board.o sernum.o spi.o flash.o dfu.o dfu_common.o \ dfu_common.o usb.o boot-atu2.o
$(USB_OBJS)
vpath %.c usb/ vpath %.c usb/
@ -110,16 +109,32 @@ version.c:
# ----- Dependencies ---------------------------------------------------------- # ----- Dependencies ----------------------------------------------------------
MKDEP = \
$(DEPEND) $< | \
sed \
-e 's|^$(basename $(notdir $<)).o:|$@:|' \
-e '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' \
-e d >$(basename $@).d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || \
{ rm -f $(basename $@).d; exit 1; }
%.o: %.c %.o: %.c
$(CC) $(CFLAGS) -Os -c $< $(CC) $(CFLAGS) -Os -c $<
$(DEPEND) $< | \ $(MKDEP)
sed -e \
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' -e d >$*.d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
-include $(OBJS:.o=.d) -include $(OBJS:.o=.d)
# ----- Object file variants --------------------------------------------------
app-%.o: usb/%.c
$(CC) $(CFLAGS) -Os -o $@ -c $<
$(MKDEP)
boot-%.o: usb/%.c
$(CC) $(CFLAGS) -DBOOT_LOADER -Os -o $@ -c $<
$(MKDEP)
# ----- Programming and device control ---------------------------------------- # ----- Programming and device control ----------------------------------------
upload: $(NAME).bin boot.hex upload: $(NAME).bin boot.hex