Makefile 435 B

123456789101112131415161718192021222324252627
  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 "};" >>$@