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-02-26 20:04:10 +01:00
|
|
|
CFLAGS += -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
|
2010-02-22 00:47:12 +01:00
|
|
|
|
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,$@)
|
|
|
|
$(Q)mkdir -p $(OBJDIR)
|
|
|
|
$(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-20 22:28:22 +02:00
|
|
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR)/board.a($(addprefix $(OBJDIR)/, $(COBJS)))
|
2010-09-25 21:09:26 +02:00
|
|
|
else
|
|
|
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h
|
|
|
|
$(call pretty,AR (empty),$@)
|
|
|
|
$Q$(AR) $(ARFLAGS) $@
|
|
|
|
endif
|
2010-09-20 22:28:22 +02:00
|
|
|
|
|
|
|
# And is built from files in the parent directory
|
|
|
|
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h
|
2010-09-25 00:21:29 +02:00
|
|
|
$(call pretty,CC,$@)
|
|
|
|
$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-09-20 22:28:22 +02:00
|
|
|
$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
|
|
|
@$(FINALIZE_DEPENDENCY)
|
|
|
|
|
|
|
|
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_*
|