|
@ -1,17 +1,18 @@ |
|
|
TARGET := image |
|
|
TARGET := image |
|
|
TARGET_SIM := borgsim |
|
|
TARGET_SIM := borgsim |
|
|
TOPDIR = . |
|
|
TOPDIR = src |
|
|
|
|
|
MAKETOPDIR = . |
|
|
|
|
|
|
|
|
SRC = \
|
|
|
SRC = \
|
|
|
main.c \
|
|
|
$(TOPDIR)/main.c \
|
|
|
display_loop.c \
|
|
|
$(TOPDIR)/display_loop.c \
|
|
|
eeprom_reserve.c \
|
|
|
$(TOPDIR)/eeprom_reserve.c \
|
|
|
pixel.c \
|
|
|
$(TOPDIR)/pixel.c \
|
|
|
util.c \
|
|
|
$(TOPDIR)/util.c \
|
|
|
|
|
|
|
|
|
SRC_SIM = \
|
|
|
SRC_SIM = \
|
|
|
display_loop.c \
|
|
|
$(TOPDIR)/display_loop.c \
|
|
|
pixel.c \
|
|
|
$(TOPDIR)/pixel.c \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LAUNCH_BOOTLOADER = launch-bootloader |
|
|
LAUNCH_BOOTLOADER = launch-bootloader |
|
@ -24,26 +25,26 @@ all: compile-$(TARGET) |
|
|
@echo "===============================" |
|
|
@echo "===============================" |
|
|
@echo "$(TARGET) compiled for: $(MCU)" |
|
|
@echo "$(TARGET) compiled for: $(MCU)" |
|
|
@echo "size is: " |
|
|
@echo "size is: " |
|
|
@$(CONFIG_SHELL) ${TOPDIR}/scripts/size $(TARGET) |
|
|
@$(CONFIG_SHELL) scripts/size $(TARGET) |
|
|
@echo "===============================" |
|
|
@echo "===============================" |
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
##############################################################################
|
|
|
# generic fluff
|
|
|
# generic fluff
|
|
|
include defaults.mk |
|
|
include $(MAKETOPDIR)/defaults.mk |
|
|
#include $(TOPDIR)/rules.mk
|
|
|
#include $(MAKETOPDIR)/rules.mk
|
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
##############################################################################
|
|
|
# generate SUBDIRS variable
|
|
|
# generate SUBDIRS variable
|
|
|
#
|
|
|
#
|
|
|
|
|
|
|
|
|
.subdirs: autoconf.h |
|
|
.subdirs: $(TOPDIR)/autoconf.h |
|
|
@ echo "checking in which subdirs to build" |
|
|
@ echo "checking in which subdirs to build" |
|
|
@ $(RM) -f $@ |
|
|
@ $(RM) -f $@ |
|
|
@ echo "SUBDIRS += animations" >> $@ |
|
|
@ echo "SUBDIRS += $(TOPDIR)/animations" >> $@ |
|
|
@ echo "SUBDIRS += animations/bitmapscroller" >> $@ |
|
|
@ echo "SUBDIRS += $(TOPDIR)/animations/bitmapscroller" >> $@ |
|
|
@ echo "SUBDIRS += smallani" >> $@ |
|
|
@ echo "SUBDIRS += $(TOPDIR)/smallani" >> $@ |
|
|
@ (for subdir in `grep -e "^#define .*_SUPPORT" autoconf.h \
|
|
|
@ (for subdir in `grep -e "^#define .*_SUPPORT" $(TOPDIR)/autoconf.h \
|
|
|
| sed -e "s/^#define //" -e "s/_SUPPORT.*//" \
|
|
|
| sed -e "s/^#define /$(TOPDIR)\//" -e "s/_SUPPORT.*//" \
|
|
|
| tr "[A-Z]\\n" "[a-z] " `; do \
|
|
|
| tr "[A-Z]\\n" "[a-z] " `; do \
|
|
|
test -d $$subdir && echo "SUBDIRS += $$subdir" ; \
|
|
|
test -d $$subdir && echo "SUBDIRS += $$subdir" ; \
|
|
|
done) | sort -u >> $@ |
|
|
done) | sort -u >> $@ |
|
@ -53,8 +54,8 @@ ifneq ($(MAKECMDGOALS),clean) |
|
|
ifneq ($(MAKECMDGOALS),mrproper) |
|
|
ifneq ($(MAKECMDGOALS),mrproper) |
|
|
ifneq ($(MAKECMDGOALS),menuconfig) |
|
|
ifneq ($(MAKECMDGOALS),menuconfig) |
|
|
|
|
|
|
|
|
include $(TOPDIR)/.subdirs |
|
|
include $(MAKETOPDIR)/.subdirs |
|
|
include $(TOPDIR)/.config |
|
|
include $(MAKETOPDIR)/.config |
|
|
include $(TOPDIR)/games/games.mk |
|
|
include $(TOPDIR)/games/games.mk |
|
|
|
|
|
|
|
|
endif # MAKECMDGOALS!=menuconfig
|
|
|
endif # MAKECMDGOALS!=menuconfig
|
|
@ -65,7 +66,7 @@ endif # no_deps!=t |
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
|
SUBDIRS_AVR = borg_hw |
|
|
SUBDIRS_AVR = $(TOPDIR)/borg_hw |
|
|
SUBDIRS_AVR += $(SUBDIRS) |
|
|
SUBDIRS_AVR += $(SUBDIRS) |
|
|
|
|
|
|
|
|
.PHONY: compile-subdirs_avr |
|
|
.PHONY: compile-subdirs_avr |
|
@ -77,7 +78,7 @@ compile-$(TARGET): compile-subdirs_avr $(TARGET).hex $(TARGET).bin $(TARGET).lst |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC}) |
|
|
OBJECTS += $(patsubst $(TOPDIR)/%.c,$(TOPDIR)/obj_avr/%.o,${SRC}) |
|
|
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS_AVR),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects 2>/dev/null),$(subdir)/$(object))) |
|
|
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS_AVR),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects 2>/dev/null),$(subdir)/$(object))) |
|
|
|
|
|
|
|
|
$(TARGET): $(OBJECTS) $(SUBDIROBJECTS) |
|
|
$(TARGET): $(OBJECTS) $(SUBDIROBJECTS) |
|
@ -86,8 +87,8 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS) |
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
##############################################################################
|
|
|
#generic rules for AVR-Build
|
|
|
#generic rules for AVR-Build
|
|
|
./obj_avr/%.o: %.c |
|
|
$(TOPDIR)/obj_avr/%.o: $(TOPDIR)/%.c |
|
|
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi |
|
|
@ if [ ! -d $(TOPDIR)/obj_avr ]; then mkdir $(TOPDIR)/obj_avr ; fi |
|
|
@ echo "compiling $<" |
|
|
@ echo "compiling $<" |
|
|
@ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< |
|
|
@ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< |
|
|
|
|
|
|
|
@ -109,25 +110,25 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS) |
|
|
##############################################################################
|
|
|
##############################################################################
|
|
|
#Rules for simulator build
|
|
|
#Rules for simulator build
|
|
|
|
|
|
|
|
|
SUBDIRS_SIM = simulator |
|
|
SUBDIRS_SIM = $(TOPDIR)/simulator |
|
|
SUBDIRS_SIM += $(SUBDIRS) |
|
|
SUBDIRS_SIM += $(SUBDIRS) |
|
|
|
|
|
|
|
|
.PHONY: compile-subdirs_sim |
|
|
.PHONY: compile-subdirs_sim |
|
|
compile-subdirs_sim: |
|
|
compile-subdirs_sim: |
|
|
@ for dir in $(SUBDIRS_SIM); do $(MAKE) -C $$dir objects_sim || exit 5; done |
|
|
@ for dir in $(SUBDIRS_SIM); do $(MAKE) -C $$dir objects_sim || exit 5; done |
|
|
@ $(MAKE) -C ./simulator/ objects_sim || exit 5; |
|
|
@ $(MAKE) -C $(TOPDIR)/simulator/ objects_sim || exit 5; |
|
|
|
|
|
|
|
|
simulator: autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM) |
|
|
simulator: $(TOPDIR)/autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM) |
|
|
|
|
|
|
|
|
SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS_SIM),$(foreach object,$(shell cat $(subdir)/obj_sim/.objects 2>/dev/null),$(subdir)/$(object))) |
|
|
SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS_SIM),$(foreach object,$(shell cat $(subdir)/obj_sim/.objects 2>/dev/null),$(subdir)/$(object))) |
|
|
|
|
|
|
|
|
OBJECTS_SIM = $(patsubst %.c,obj_sim/%.o,${SRC_SIM}) |
|
|
OBJECTS_SIM = $(patsubst $(TOPDIR)/%.c,$(TOPDIR)/obj_sim/%.o,${SRC_SIM}) |
|
|
|
|
|
|
|
|
$(TARGET_SIM): $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM) |
|
|
$(TARGET_SIM): $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM) |
|
|
$(HOSTCC) $(LDFLAGS_SIM) -o $@ $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM) $(LIBS_SIM) |
|
|
$(HOSTCC) $(LDFLAGS_SIM) -o $@ $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM) $(LIBS_SIM) |
|
|
|
|
|
|
|
|
./obj_sim/%.o: %.c |
|
|
$(TOPDIR)/obj_sim/%.o: $(TOPDIR)/%.c |
|
|
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi |
|
|
@ if [ ! -d $(TOPDIR)/obj_sim ]; then mkdir $(TOPDIR)/obj_sim ; fi |
|
|
@ echo "compiling $<" |
|
|
@ echo "compiling $<" |
|
|
@ $(HOSTCC) -o $@ $(CFLAGS_SIM) -c $< |
|
|
@ $(HOSTCC) -o $@ $(CFLAGS_SIM) -c $< |
|
|
|
|
|
|
|
@ -172,10 +173,14 @@ clean: |
|
|
test "x$$subdir" != "x." \
|
|
|
test "x$$subdir" != "x." \
|
|
|
&& test -e $$subdir/Makefile \
|
|
|
&& test -e $$subdir/Makefile \
|
|
|
&& $(MAKE) no_deps=t -C $$subdir clean ; done ; true |
|
|
&& $(MAKE) no_deps=t -C $$subdir clean ; done ; true |
|
|
|
|
|
$(RM) -r $(TOPDIR)/obj_avr |
|
|
|
|
|
$(RM) -r $(TOPDIR)/obj_sim |
|
|
|
|
|
$(RM) $(TARGET)* |
|
|
|
|
|
$(RM) $(TARGET_SIM) $(TARGET_SIM).exe |
|
|
|
|
|
|
|
|
mrproper: |
|
|
mrproper: |
|
|
$(MAKE) clean |
|
|
$(MAKE) clean |
|
|
$(RM) -f autoconf.h .config config.mk .menuconfig.log .config.old |
|
|
$(RM) -f $(TOPDIR)/autoconf.h .config config.mk .menuconfig.log .config.old |
|
|
|
|
|
|
|
|
sflash: $(TARGET).hex |
|
|
sflash: $(TARGET).hex |
|
|
# $(LAUNCH_BOOTLOADER) $(SERIAL) 115200
|
|
|
# $(LAUNCH_BOOTLOADER) $(SERIAL) 115200
|
|
@ -189,23 +194,23 @@ uflash: $(TARGET).hex |
|
|
##############################################################################
|
|
|
##############################################################################
|
|
|
# configure ethersex
|
|
|
# configure ethersex
|
|
|
#
|
|
|
#
|
|
|
show-config: autoconf.h |
|
|
show-config: $(TOPDIR)/autoconf.h |
|
|
@echo |
|
|
@echo |
|
|
@echo "These modules are currently enabled: " |
|
|
@echo "These modules are currently enabled: " |
|
|
@echo "======================================" |
|
|
@echo "======================================" |
|
|
@grep -e "^#define .*_SUPPORT" autoconf.h | sed -e "s/^#define / * /" -e "s/_SUPPORT.*//" |
|
|
@grep -e "^#define .*_SUPPORT" $(TOPDIR)/autoconf.h | sed -e "s/^#define / * /" -e "s/_SUPPORT.*//" |
|
|
|
|
|
|
|
|
.PHONY: show-config |
|
|
.PHONY: show-config |
|
|
|
|
|
|
|
|
autoconf.h .config: |
|
|
$(TOPDIR)/autoconf.h .config: |
|
|
@echo make\'s goal: $(MAKECMDGOALS) |
|
|
@echo make\'s goal: $(MAKECMDGOALS) |
|
|
ifneq ($(MAKECMDGOALS),menuconfig) |
|
|
ifneq ($(MAKECMDGOALS),menuconfig) |
|
|
# make sure menuconfig isn't called twice, on `make menuconfig' |
|
|
# make sure menuconfig isn't called twice, on `make menuconfig' |
|
|
#test -s autoconf.h -a -s .config || $(MAKE) no_deps=t menuconfig |
|
|
#test -s $(TOPDIR)/autoconf.h -a -s .config || $(MAKE) no_deps=t menuconfig |
|
|
# test the target file, test fails if it doesn't exist |
|
|
# test the target file, test fails if it doesn't exist |
|
|
# and will keep make from looping menuconfig. |
|
|
# and will keep make from looping menuconfig. |
|
|
#test -s autoconf.h -a -s .config |
|
|
#test -s $(TOPDIR)/autoconf.h -a -s .config |
|
|
touch autoconf.h .config |
|
|
touch $(TOPDIR)/autoconf.h .config |
|
|
endif |
|
|
endif |
|
|
|
|
|
|
|
|
include depend.mk |
|
|
include $(MAKETOPDIR)/depend.mk |
|
|