
#MIT License
#
#Copyright (c) 2016 Aleksandr Fenenko
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.


all: sfc.elf
	
sfc.elf: core.out hadware.out words.out interrupt_table.out 
	arm-none-eabi-ld -v -nostartfiles  -T stm32.ldscript -o sfc.elf core.out hadware.out words.out interrupt_table.out
	arm-none-eabi-objcopy -O binary sfc.elf sfc.bin

core.out: core.s
	arm-none-eabi-as -g -ahls=core.lst -mthumb core.s -o core.out


hadware.out:	hadware.s
	arm-none-eabi-as -g -ahls=hadware.lst -mthumb hadware.s -o hadware.out


words.out: words.s
	arm-none-eabi-as -g -ahls=words.lst -mthumb  words.s -o words.out

interrupt_table.out: interrupt_table.s
	arm-none-eabi-as -g -ahls=interrupt_table.lst -mthumb interrupt_table.s -o interrupt_table.out




info: 
	arm-none-eabi-objdump -h sfc.elf

clean:
	rm -r *.out *.lst *.elf *.bin 

clean_win32:
	del -r *.out *.lst *.elf *.bin

