nes-proj/arch/platform/cooja/Makefile.customrules-cooja

37 lines
1.2 KiB
Makefile

### Define custom targets
CUSTOM_RULE_C_TO_CE=1
#CUSTOM_RULE_C_TO_OBJECTDIR_O=1
CUSTOM_RULE_S_TO_OBJECTDIR_O=1
#CUSTOM_RULE_C_TO_O=1
#CUSTOM_RULE_C_TO_CO=1
CUSTOM_RULE_ALLOBJS_TO_TARGETLIB=1
CUSTOM_RULE_LINK=1
REDEF_PRINTF=1 # Redefine functions to enable printf()s inside Cooja
# NB: Assumes ARCHIVE was not overridden and is in $(BUILD_DIR_BOARD)
$(ARCHIVE): $(CONTIKI_OBJECTFILES) | $(OBJECTDIR)
$(AR_COMMAND_1) $^ $(AR_COMMAND_2)
# NB: Assumes JNILIB was not overridden and is in $(BUILD_DIR_BOARD)
$(JNILIB): $(CONTIKI_APP_OBJ) $(MAIN_OBJ) $(PROJECT_OBJECTFILES) $(ARCHIVE) | $(OBJECTDIR)
ifdef REDEF_PRINTF
@echo Redefining printf
-$(foreach OBJ,$^, $(OBJCOPY) --redefine-sym printf=log_printf $(OBJ); )
-$(foreach OBJ,$^, $(OBJCOPY) --redefine-sym puts=log_puts $(OBJ); )
-$(foreach OBJ,$^, $(OBJCOPY) --redefine-sym putchar=log_putchar $(OBJ); )
endif ## REDEF_PRINTF
$(LINK_COMMAND_1) $^ $(LINK_COMMAND_2)
.PHONY: $(CONTIKI_APP).cooja
$(CONTIKI_APP).cooja: $(JNILIB)
cp $(JNILIB) $@
rm $(CONTIKI_APP_OBJ)
# Trickiness: GNU make matches this against the file base name.
# Assume that the directory part is the standard location.
mtype%.o: platform.o | $(OBJECTDIR)
mv platform.o $@