2010-02-26 07:16:06 -05:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
2010-09-20 16:28:22 -04:00
|
|
|
ALL_BOARDS = redbee-dev redbee-r1 redbee-usb redbee-econotag quahogcon freescale-ncb
|
2010-02-22 19:18:48 -05:00
|
|
|
|
2010-09-20 16:28:22 -04:00
|
|
|
OBJDIR = obj_$(BOARD)
|
2010-09-25 15:26:44 -04:00
|
|
|
CFLAGS += -I. -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
|
2010-02-21 18:47:12 -05:00
|
|
|
|
2010-09-28 15:48:57 -04:00
|
|
|
OBJDIR_COBJS = $(addprefix $(OBJDIR)/, $(COBJS))
|
|
|
|
|
2010-09-20 16:28:22 -04:00
|
|
|
# Create directory and board.h include
|
|
|
|
$(OBJDIR)/board.h:
|
2010-09-24 18:21:29 -04:00
|
|
|
$(call pretty,GEN,$@)
|
2010-10-03 14:32:59 -04:00
|
|
|
@mkdir -p $(dir $@)
|
2010-09-24 18:21:29 -04:00
|
|
|
$(Q)echo '/* This file was automatically generated */' > $(OBJDIR)/board.h
|
|
|
|
$(Q)echo '#include "$(BOARD).h"' >> $(OBJDIR)/board.h
|
2010-09-20 16:28:22 -04:00
|
|
|
|
|
|
|
# $(OBJDIR)/board.a contains all the objects defined in COBJS
|
2010-09-25 15:09:26 -04:00
|
|
|
ifdef COBJS
|
2010-09-28 15:48:57 -04:00
|
|
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR_COBJS)
|
|
|
|
$(call pretty,AR,$@)
|
|
|
|
@rm -f $@
|
|
|
|
$Q$(AR) $(ARFLAGS) $@ $(OBJDIR_COBJS)
|
2010-09-25 15:09:26 -04:00
|
|
|
else
|
|
|
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h
|
|
|
|
$(call pretty,AR (empty),$@)
|
2010-09-28 15:48:57 -04:00
|
|
|
@rm -f $@
|
2010-09-25 15:09:26 -04:00
|
|
|
$Q$(AR) $(ARFLAGS) $@
|
|
|
|
endif
|
2010-09-20 16:28:22 -04:00
|
|
|
|
2010-09-28 02:54:23 -04:00
|
|
|
TARGET_OBJ += $(OBJDIR)/board.a
|
|
|
|
|
2010-09-20 16:28:22 -04:00
|
|
|
# And is built from files in the parent directory
|
2010-09-28 02:15:43 -04:00
|
|
|
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h $(FORCE_C_DEPENDS)
|
2010-09-24 18:21:29 -04:00
|
|
|
$(call pretty,CC,$@)
|
2010-10-03 14:32:59 -04:00
|
|
|
@mkdir -p $(dir $@)
|
2010-09-24 18:21:29 -04:00
|
|
|
$Q$(CC) $(CFLAGS) $(CFLAGS_THUMB) -MMD -c -o $@ $<
|
2010-09-20 16:28:22 -04:00
|
|
|
@$(FINALIZE_DEPENDENCY)
|
2010-02-23 15:53:00 -05:00
|
|
|
|
2010-09-20 16:28:22 -04:00
|
|
|
$(OBJDIR)/%.o: %.S $(OBJDIR)/board.h
|
2010-09-24 18:21:29 -04:00
|
|
|
$(call pretty,AS,$@)
|
2010-10-03 14:32:59 -04:00
|
|
|
@mkdir -p $(dir $@)
|
2010-09-20 16:28:22 -04:00
|
|
|
$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
|
|
|
@$(FINALIZE_DEPENDENCY)
|
|
|
|
|
2010-09-27 20:04:24 -04:00
|
|
|
$(OBJDIR)/%.dis: $(OBJDIR)/%.o
|
|
|
|
$(call pretty,OBJDUMP,$@)
|
|
|
|
$Q$(OBJDUMP) -d $< > $@ || rm -f $@
|
|
|
|
|
2010-09-20 16:28:22 -04:00
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
|
|
-include $(wildcard $(OBJDIR)/*.d)
|
|
|
|
endif
|
2010-03-01 14:30:19 -05:00
|
|
|
|
2010-09-20 16:28:22 -04:00
|
|
|
clean::
|
|
|
|
rm -rf obj_*
|