Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. TARGET = ipac
  2. # Application source en include includes
  3. SRC_DIR = .
  4. INC_DIR = ./lib/
  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. # Alle source files in de huidige directory (wildcard op .c)
  19. SRCS = $(wildcard *.c)
  20. OBJS = $(SRCS:%.c=%.o)
  21. NUT_LIBS = $(NUT_LIB_DIR)/nutinit.o -lnutpro -lnutnet -lnutpro -lnutfs -lnutos -lnutdev -lnutarch -lnutnet -lnutcrt -lnutdev
  22. # Alle includes (header files) in de huidige directory
  23. INCS = $(wildcard *.h)
  24. # Linking rule. All *.o to elf file. Then convert to *.hex
  25. $(TARGET): $(OBJS)
  26. $(CC) $(OBJS) $(LDFLAGS) -L$(NUT_LIB_DIR) $(NUT_LIBS) -o $@.elf
  27. avr-objcopy -O ihex $@.elf $@.hex
  28. # hex2bin -ebin $@.hex
  29. # Compiling the objs's. avr-gcc autocalls assembler
  30. $(SRC_DIR)/%o: $(SRC_DIR)/%c
  31. $(CC) -c $< $(CFLAGS) -I$(INC_DIR) -I$(NUT_INC) -I$(AVR_INC) -o $@
  32. all: $(TARGET)
  33. debug:
  34. @echo $(OBJS)
  35. .PHONY: clean
  36. clean:
  37. -rm -f $(OBJS)
  38. -rm -f $(SRCS:.c=.lst)
  39. -rm -f *.hex *.elf *.map *.bin