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