osd-contiki/Makefile.include

98 lines
1.9 KiB
Makefile
Raw Normal View History

2010-02-26 13:16:06 +01:00
# -*- makefile -*-
2010-02-26 13:30:53 +01:00
CROSS_COMPILE := arm-linux-
LINKERSCRIPT := $(MC1322X)/mc1322x.lds
LIBMC1322X := $(MC1322X)/libmc1322x
2010-02-21 23:34:27 +01:00
2010-02-22 00:47:12 +01:00
include $(MC1322X)/config.mk
2010-02-21 23:34:27 +01:00
2010-02-22 00:47:12 +01:00
include $(MC1322X)/board/Makefile.board
include $(MC1322X)/libmc1322x/Makefile.lib
2010-02-21 23:34:27 +01:00
CFLAGS += -I$(MC1322X)/src -I.
# default start and isr
ifndef START
START = $(MC1322X)/src/start.o
endif
ifndef ISR
ISR = $(MC1322X)/src/isr.o
endif
SRCOBJS += $(MC1322X)/src/default_lowlevel.o
BOARDOBJS := $(addprefix $(OBJDIR)/,$(COBJS))
2010-02-21 23:34:27 +01:00
ARCH = arm
CPU = arm7tdmi-s
export ARCH CPU VENDOR
2010-02-23 00:58:45 +01:00
.SECONDARY:
#.depend: Makefile $(AOBJS:.o=.S) $(COBJS:.o=.c)
# $(CC) -M $(CFLAGS) $(AOBJS:.o=.S) $(COBJS:.o=.c) > $@
#sinclude .depend
2010-02-23 00:58:45 +01:00
$(START): $(START:.o=.s)
$(CC) $(AFLAGS) -c -o $@ $<
2010-02-21 23:34:27 +01:00
$(ISR): $(ISR:.o=.c)
$(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@
2010-02-21 23:34:27 +01:00
%_$(BOARD).elf: %.elf $(BOARDOBJS)
2010-02-23 00:58:45 +01:00
mv $< $@
%.elf: $(START) $(ISR) $(SRCOBJS) $(OBJDIR)/%.o $(BOARDOBJS) $(LINKERSCRIPT) $(LIBMC1322X)/libmc1322x.a
$(CC) $(LDFLAGS) $(AOBJS) \
$(filter %.o %.a,$+) -o $@
2010-02-21 23:34:27 +01:00
2010-02-23 21:53:00 +01:00
%.srec: %.elf
$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
%.ihex: %.elf
$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
%.bin: %.elf
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
%.dis: %.elf
$(OBJDUMP) -SD $< > $@
2010-02-23 00:58:45 +01:00
$(OBJDIR)/%.s: %.S
$(CPP) $(AFLAGS) -o $@ $<
$(OBJDIR)/%.o: %.S
$(CC) $(AFLAGS) -c -o $@ $<
$(OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) $(THUMB_FLAGS) -c -o $@ $<
2010-02-21 23:34:27 +01:00
clean:
2010-02-23 01:01:18 +01:00
find $(MC1322X) \
2010-02-21 23:34:27 +01:00
\( -name 'core' -o -name '*.bak' -o -name '*~' \
2010-02-23 01:01:18 +01:00
-o -name '*.o' -o -name '*.a' -o -name '*.obj' -o -name '*.elf' -o -name '*.s' -o -name '*.map' \
2010-02-23 21:53:00 +01:00
-o -name 'obj_*_board' -o -name '.depend' -o -name '*.bin' -o -name '*.dis' \) -print \
2010-02-23 01:01:18 +01:00
| xargs rm -rf
2010-02-22 18:24:56 +01:00
rm -fr *.*~
2010-02-21 23:34:27 +01:00
2010-02-22 18:24:56 +01:00
clobber \
2010-02-21 23:34:27 +01:00
mrproper \
2010-02-22 18:24:56 +01:00
distclean: clean
2010-02-24 00:27:12 +01:00
#.DEFAULT_GOAL := all
ifndef BOARD
.DEFAULT_GOAL := allboards
else
2010-02-24 00:27:12 +01:00
.DEFAULT_GOAL := all
endif
all: $(OBJDIR)/board.h
for target in $(TARGETS); do make $$target\_$(BOARD).bin; done
allboards:
for board in $(BOARDS); do make BOARD=$$board all; done
2010-02-24 00:27:12 +01:00