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