Makefile 922 B

1234567891011121314151617181920212223242526272829303132
  1. CC = arm-none-eabi-gcc
  2. LD = arm-none-eabi-gcc -v
  3. CP = arm-none-eabi-objcopy
  4. OD = arm-none-eabi-objdump
  5. CFLAGS = -I./ -I./lib -I./inc -c -fno-common -O0 -g -mcpu=cortex-m0 -mthumb
  6. LFLAGS = -Tstm32f0.ld -nostartfiles
  7. ODFLAGS = -S
  8. AR+= -rcs
  9. all: test
  10. clean: -rm build/main.lst build/startup_stm32f0xx.o build/main.o build/main.elf build/main.lst build/main.bin
  11. test: main.elf
  12. @ echo "...copying"
  13. $(CP) -O binary build/main.elf build/main.bin
  14. $(CP) -O ihex build/main.elf build/main.hex
  15. $(OD) $(ODFLAGS) build/main.elf > build/main.lst
  16. main.elf: main.o startup.o stm32f0.ld
  17. @ echo "..linking"
  18. $(LD) $(LFLAGS) -o build/main.elf build/main.o build/startup_stm32f0xx.o
  19. main.o: source/main.c
  20. @ echo ".compiling"
  21. $(CC) $(CFLAGS) source/main.c -o build/main.o
  22. startup.o: source/startup_stm32f0xx.s
  23. @ echo ".compiling"
  24. $(CC) $(CFLAGS) source/startup_stm32f0xx.s -o build/startup_stm32f0xx.o