From 013cf7c8d570d08a8681048a92e9099b900a1b49 Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Thu, 20 Mar 2014 01:23:36 +0100 Subject: [PATCH] prevented creation of config.mk files in subdirectories --- Makefile | 19 +++++++++---------- defaults.mk | 22 ++++++++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 550d826..d1095db 100644 --- a/Makefile +++ b/Makefile @@ -168,27 +168,26 @@ test: ############################################################################## clean: $(MAKE) -f rules.mk no_deps=t clean-common - $(RM) $(TARGET) $(TARGET).bin $(TARGET).hex $(TARGET).lst .subdirs + $(RM) -f $(TARGET) $(TARGET).bin $(TARGET).hex $(TARGET).lst .subdirs + $(RM) -f $(TARGET).map for subdir in `find . -type d` ; do \ test "x$$subdir" != "x." \ && test -e $$subdir/Makefile \ && $(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 + $(RM) -fr $(TOPDIR)/obj_avr $(TOPDIR)/obj_sim + $(RM) -f $(TARGET_SIM) $(TARGET_SIM).exe mrproper: $(MAKE) clean $(RM) -f $(TOPDIR)/autoconf.h .config config.mk .menuconfig.log .config.old -sflash: $(TARGET).hex +#sflash: $(TARGET).hex # $(LAUNCH_BOOTLOADER) $(SERIAL) 115200 - avrdude -p m32 -b 115200 -u -c avr109 -P $(SERIAL) -U f:w:$< -F - echo X > $(SERIAL) +# avrdude -p m32 -b 115200 -u -c avr109 -P $(SERIAL) -U f:w:$< -F +# echo X > $(SERIAL) -uflash: $(TARGET).hex - avrdude -c usbasp -p atmega32 -V -U f:w:$< -F +#uflash: $(TARGET).hex +# avrdude -c usbasp -p atmega32 -V -U f:w:$< -F .PHONY: clean mrproper sflash uflash ############################################################################## diff --git a/defaults.mk b/defaults.mk index 13e3ac3..129e2c5 100644 --- a/defaults.mk +++ b/defaults.mk @@ -45,7 +45,8 @@ ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN) LIBS_SIM = -lgdi32 -lwinmm -lm else ifeq ($(OSTYPE),FreeBSD) - CFLAGS_SIM = -g -I/usr/local/include -Wall -pedantic -std=c99 -O0 -D_XOPEN_SOURCE=600 + CFLAGS_SIM = -g -I/usr/local/include -Wall -pedantic -std=c99 -O0 + CFLAGS_SIM += -D_XOPEN_SOURCE=600 ifeq ($(MACHINE),amd64) LDFLAGS_SIM = -L/usr/local/lib -T ld_scripts/elf_x86_64_fbsd.x else @@ -78,12 +79,17 @@ $(TARGET): ############################################################################## # include user's config.mk file -config.mk: - @echo "# Put your own config here!" > $@ - @echo "#F_CPU = $(F_CPU)" >> $@ - @echo "#MCU = $(MCU)" >> $@ - @echo "created default config.mk, tune your settings there!" --include config.mk +$(MAKETOPDIR)/config.mk: + @echo "# Customize your config here!" >$@ + @echo "# Add further CFLAGS by using the += operator, eg." >>$@ + @echo "# CFLAGS += -mstrict-X" >>$@ + @echo "#" >>$@ + @echo "# In case you wonder: -mstrict-X produces smaller code, but" >>$@ + @echo "# is only available on avr-gcc 4.7.0 or higher." >>$@ + @echo "#" >>$@ + @echo "# Other flags you might want to tune: CPPFLAGS, LDFLAGS ..." >>$@ + @echo "Created default config.mk, tune your settings there!" +-include $(MAKETOPDIR)/config.mk ############################################################################## @@ -97,7 +103,7 @@ include $(MAKETOPDIR)/.config CPPFLAGS += -DF_CPU=$(FREQ)UL -mmcu=$(MCU) -# flags for the linker +# flags for the linker, choose appropriate linker script ifeq ($(findstring atmega128,$(MCU)),atmega128) LDFLAGS += -T ld_scripts/avr51.x -Wl,-Map,image.map -mmcu=$(MCU) else