mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 16:29:34 +00:00
d5118ba63d
This lets us put things like fatfs/ff.o in COBJS
55 lines
1.3 KiB
Makefile
55 lines
1.3 KiB
Makefile
# -*- makefile -*-
|
|
|
|
ALL_BOARDS = redbee-dev redbee-r1 redbee-usb redbee-econotag quahogcon freescale-ncb
|
|
|
|
OBJDIR = obj_$(BOARD)
|
|
CFLAGS += -I. -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
|
|
|
|
OBJDIR_COBJS = $(addprefix $(OBJDIR)/, $(COBJS))
|
|
|
|
# Create directory and board.h include
|
|
$(OBJDIR)/board.h:
|
|
$(call pretty,GEN,$@)
|
|
@mkdir -p $(dir $@)
|
|
$(Q)echo '/* This file was automatically generated */' > $(OBJDIR)/board.h
|
|
$(Q)echo '#include "$(BOARD).h"' >> $(OBJDIR)/board.h
|
|
|
|
# $(OBJDIR)/board.a contains all the objects defined in COBJS
|
|
ifdef COBJS
|
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR_COBJS)
|
|
$(call pretty,AR,$@)
|
|
@rm -f $@
|
|
$Q$(AR) $(ARFLAGS) $@ $(OBJDIR_COBJS)
|
|
else
|
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h
|
|
$(call pretty,AR (empty),$@)
|
|
@rm -f $@
|
|
$Q$(AR) $(ARFLAGS) $@
|
|
endif
|
|
|
|
TARGET_OBJ += $(OBJDIR)/board.a
|
|
|
|
# And is built from files in the parent directory
|
|
$(OBJDIR)/%.o: %.c $(OBJDIR)/board.h $(FORCE_C_DEPENDS)
|
|
$(call pretty,CC,$@)
|
|
@mkdir -p $(dir $@)
|
|
$Q$(CC) $(CFLAGS) $(CFLAGS_THUMB) -MMD -c -o $@ $<
|
|
@$(FINALIZE_DEPENDENCY)
|
|
|
|
$(OBJDIR)/%.o: %.S $(OBJDIR)/board.h
|
|
$(call pretty,AS,$@)
|
|
@mkdir -p $(dir $@)
|
|
$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
|
@$(FINALIZE_DEPENDENCY)
|
|
|
|
$(OBJDIR)/%.dis: $(OBJDIR)/%.o
|
|
$(call pretty,OBJDUMP,$@)
|
|
$Q$(OBJDUMP) -d $< > $@ || rm -f $@
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
-include $(wildcard $(OBJDIR)/*.d)
|
|
endif
|
|
|
|
clean::
|
|
rm -rf obj_*
|