Makefile 455 B

123456789101112131415161718192021222324252627
  1. LD := clang
  2. LDFLAGS := -nostartfiles
  3. BFILES := $(wildcard *.b)
  4. .PHONY: clean
  5. .PRECIOUS: $(patsubst %.b,%.ll %-opt.ll,$(BFILES))
  6. bf: bf.ml
  7. ocamlopt -o $@ -g -I /usr/lib/ocaml/llvm-3.5 llvm.cmxa $^
  8. %: %.o
  9. $(LD) -o $@ $< $(LDFLAGS)
  10. %.o: %.ll
  11. llc-3.5 -filetype obj -o $@ $<
  12. %.ll: %.bc
  13. llvm-dis-3.5 -o $@ $<
  14. %-opt.ll: %.ll
  15. opt-3.5 -O3 -S -o $@ $<
  16. %.ll: %.b bf
  17. ./bf < $< > $@
  18. clean:
  19. rm -f bf *.cmi *.cmx *.ll *.bc *.o $(patsubst %.b,%,$(BFILES))