diff options
author | Karel Kočí <cynerd@email.cz> | 2016-03-08 16:10:33 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2016-03-08 16:10:33 +0100 |
commit | 5d29fe79d30f430ae326d9dc57ccfaed6fe61328 (patch) | |
tree | 8341804d561c0060176cbebc3f9a57c7c07f7816 /examples/usartecho/Makefile | |
parent | 4e773191d447ac434536262a6f204dd991d4ad77 (diff) | |
download | avr-ioe-5d29fe79d30f430ae326d9dc57ccfaed6fe61328.tar.gz avr-ioe-5d29fe79d30f430ae326d9dc57ccfaed6fe61328.tar.bz2 avr-ioe-5d29fe79d30f430ae326d9dc57ccfaed6fe61328.zip |
Another full update of current work
Diffstat (limited to 'examples/usartecho/Makefile')
-rw-r--r-- | examples/usartecho/Makefile | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/examples/usartecho/Makefile b/examples/usartecho/Makefile new file mode 100644 index 0000000..900fe09 --- /dev/null +++ b/examples/usartecho/Makefile @@ -0,0 +1,64 @@ +MAKEFLAGS += --no-builtin-rules +PROJNAME = usartecho + +SRC = echo.c + +OBJ = $(patsubst %.c,%.o,$(SRC)) # This creates list of *.o files from *.c + +.PHONY: all +ifneq ("$(wildcard config)","") # Checking if configuration exists +all: $(PROJNAME).hex + @echo Now you can flash $< to your chip. +else +all: help +endif + +# Edit here help like you ever want +.PHONY: help +help: + @echo "AVR-IOE USART echo example" + @echo " all - Build example" + @echo " config - Start configuration program" + @echo " menuconfig - NCurses based configuration program" + @echo " help - Prints this text" + @echo " clean - Removing all object files generated from source files" + +.PHONY: clean +clean: + @echo " CLEAN OBJ" + @$(RM) $(OBJ) + @echo " CLEAN $(PROJNAME).elf $(PROJNAME).hex" + @$(RM) $(PROJNAME).elf $(PROJNAME).hex + @$(MAKE) -C ../.. clean + +# Building targets are available only if configuration is generated +ifneq ("$(wildcard config)","") +-include config +# If you want change some standard CFLAGS, change them in configuration not here. +# Add here only options that should not be applied to avr-ioe also. +CFLAGS = -I../../include -mmcu=$(MMCU) -imacros ../../.config.h \ + $(shell echo $(CONFCFLAGS)) $(shell echo -DF_CPU=$(F_CPU)000L) + +$(PROJNAME).elf: ../../libioe.a +$(PROJNAME).elf: $(OBJ) + @echo " LD $@" + @avr-gcc -Os -mmcu=$(MMCU) $^ -o $@ -L../.. -lioe + +$(PROJNAME).hex: $(PROJNAME).elf + @echo " OBJCOPY $@" + @avr-objcopy -O ihex -R .eeprom $< $@ + +$(OBJ): %.o: %.c ../../libioe.a + @echo " CC $@" + @avr-gcc $(CFLAGS) -c -o $@ $< + +../../libioe.a: config + @CONFIG=$$(readlink -f config) $(MAKE) -C ../.. libioe.a +endif + +config: + @CONFIG=$$(readlink -f config) $(MAKE) -C ../.. config + +.PHONY: menuconfig +menuconfig: + @CONFIG=$$(readlink -f config) $(MAKE) -C ../.. menuconfig |