Makefile 435 B

1234567891011121314151617181920212223242526
  1. SOURCES := $(wildcard [0-9]*x[0-9]*.S)
  2. BIN := $(patsubst %.S, %.bin, $(SOURCES))
  3. IHEX := $(patsubst %.S, %.bin.ihex, $(SOURCES))
  4. CODE := $(patsubst %.S, %.c, $(SOURCES))
  5. all: $(BIN) $(IHEX) $(CODE)
  6. clean:
  7. @rm -f *.o *.bin.ihex *.bin *.c
  8. %.o: %.S
  9. @cc -c $^
  10. %.bin: %.o
  11. @objcopy -Obinary $^ $@
  12. %.bin.ihex: %.o
  13. @objcopy -Oihex $^ $@
  14. @dos2unix $@ 2>/dev/null
  15. %.c: %.bin
  16. @echo "{" >$@; hexdump -f hex $^ >>$@; echo "};" >>$@