Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. TARGET = ipac
  2. # Application source en include includes
  3. SRC_DIR = ./source
  4. INC_DIR = ./include
  5. # NutOS location (includes and libs)
  6. NUT_INC = c:/ethernut-4.3.3/nut/include
  7. NUT_BUILD_INC = c:/ethernut-4.3.3/build/gcc/atmega2561/lib/include
  8. NUT_LIB_DIR = c:/ethernut-4.3.3/build/gcc/atmega2561/lib
  9. # WinAvr includes
  10. AVR_INC = c:/winavr/avr/include
  11. # Compiler, assembler & linker (flags)
  12. CC = avr-gcc
  13. CFLAGS = -mmcu=atmega2561 -Os -Wall -Wstrict-prototypes -DNUT_CPU_FREQ=14745600 \
  14. -D__HARVARD_ARCH__ -DNUTOS_VERSION=433 \
  15. -Wa,-ahlms=$(SRC_DIR)/$*lst
  16. ASFLAGS = -mmcu=atmega2561 -I. -x assembler-with-cpp -Wa,-ahlms=$(SRC_DIR)/$*lst,-gstabs
  17. LDFLAGS = -mmcu=atmega2561 -Wl,--defsym=main=0,-Map=TIStreamer.map,--cref
  18. # =================================================================================
  19. # Source files
  20. CFILES = main.c \
  21. uart0driver.c \
  22. log.c \
  23. led.c \
  24. keyboard.c \
  25. display.c \
  26. vs10xx.c \
  27. remcon.c \
  28. watchdog.c \
  29. mmc.c \
  30. spidrv.c \
  31. mmcdrv.c \
  32. fat.c \
  33. flash.c \
  34. rtc.c
  35. # Header files.
  36. HFILES = display.h keyboard.h \
  37. led.h \
  38. portio.h remcon.h log.h \
  39. system.h settings.h \
  40. inet.h \
  41. platform.h version.h update.h \
  42. uart0driver.h typedefs.h \
  43. vs10xx.h audio.h \
  44. watchdog.h mmc.h \
  45. flash.h spidrv.h command.h \
  46. parse.h mmcdrv.h fat.h \
  47. fatdrv.h flash.h rtc.h
  48. # Alle source files in de ./source dir
  49. SRCS = $(addprefix $(SRC_DIR)/,$(CFILES))
  50. OBJS = $(SRCS:.c=.o)
  51. NUT_LIBS = $(NUT_LIB_DIR)/nutinit.o -lnutpro -lnutnet -lnutpro -lnutfs -lnutos -lnutdev -lnutarch -lnutnet -lnutcrt -lnutdev
  52. # Alle includes (header files) in de ./header dir
  53. INCS = $(addprefix $(INC_DIR)/,$(HFILES))
  54. # Linking rule. All *.o to elf file. Then convert to *.hex
  55. $(TARGET): $(OBJS)
  56. $(CC) $(OBJS) $(LDFLAGS) -L$(NUT_LIB_DIR) $(NUT_LIBS) -o $@.elf
  57. avr-objcopy -O ihex $@.elf $@.hex
  58. # hex2bin -ebin $@.hex
  59. # Compiling the objs's. avr-gcc autocalls assembler
  60. $(SRC_DIR)/%o: $(SRC_DIR)/%c
  61. $(CC) -c $< $(CFLAGS) -I$(INC_DIR) -I$(NUT_INC) -I$(AVR_INC) -o $@
  62. all: $(TARGET)
  63. debug:
  64. @echo $(OBJS)
  65. .PHONY: clean
  66. clean:
  67. -rm -f $(OBJS)
  68. -rm -f $(SRCS:.c=.lst)
  69. -rm -f *.hex *.elf *.map *.bin