osd-contiki/board/Makefile.board
Jim Paris 0a41939407 Makefile cleanup.
This is an attempt to fix and cleanup all of the rules, and get rid of
some of the recursion.  We still need to invoke make several times
when we're building for more than one board, and some things can get a
bit weird when that happens, but it should generally work.  A single
BOARD=foo build should be fully correct, now.

I attempted to keep things compatible, so existing Makefiles that
include libmc1322x/Makefile.include should still work correctly.
2010-09-24 16:29:43 -04:00

32 lines
896 B
Makefile

# -*- makefile -*-
ALL_BOARDS = redbee-dev redbee-r1 redbee-usb redbee-econotag quahogcon freescale-ncb
OBJDIR = obj_$(BOARD)
CFLAGS += -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
# Create directory and board.h include
$(OBJDIR)/board.h:
mkdir -p $(OBJDIR)
echo '/* This file was automatically generated */' > $(OBJDIR)/board.h
echo '#include "$(BOARD).h"' >> $(OBJDIR)/board.h
# $(OBJDIR)/board.a contains all the objects defined in COBJS
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR)/board.a($(addprefix $(OBJDIR)/, $(COBJS)))
# And is built from files in the parent directory
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h
$(CC) $(CFLAGS) $(CFLAGS_THUMB) -MMD -c -o $@ $<
@$(FINALIZE_DEPENDENCY)
$(OBJDIR)/%.o: %.S $(OBJDIR)/board.h
$(CC) $(AFLAGS) -MMD -c -o $@ $<
@$(FINALIZE_DEPENDENCY)
ifneq ($(MAKECMDGOALS),clean)
-include $(wildcard $(OBJDIR)/*.d)
endif
clean::
rm -rf obj_*