Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Pre-Scheme Makefile
  2. CC=gcc
  3. FORMAT=clang-format -i
  4. PRESCHEME=prescheme
  5. CFLAGS=-g -Wall
  6. CFLAGS+=$(shell pkg-config --cflags prescheme)
  7. LDLIBS+=$(shell pkg-config --libs prescheme)
  8. SOURCES= packages.scm \
  9. lib/ps-string.scm \
  10. lib/ps-vector.scm
  11. TARGETS= hello \
  12. append \
  13. vecfun \
  14. recfun \
  15. btree
  16. all: $(TARGETS)
  17. %.c: %.scm $(SOURCES)
  18. rm -f $@
  19. ( echo ",batch"; \
  20. echo "(prescheme-compiler '$* '(\"packages.scm\") 'ps-init \"$@\""; \
  21. echo " '(header \"#include \\\"ps-init.h\\\"\")"; \
  22. echo " '(copy (ps-vector vector-unfold1))"; \
  23. echo " '(copy (ps-vector vector-unfold2))"; \
  24. echo " '(copy (ps-vector vector-unfold3))"; \
  25. echo " '(copy (ps-vector vector-fold1))"; \
  26. echo " '(copy (ps-vector vector-fold2))"; \
  27. echo " '(copy (ps-vector vector-fold3))"; \
  28. echo " '(copy (ps-vector vector-map1!))"; \
  29. echo " '(copy (ps-vector vector-map2!))"; \
  30. echo " '(copy (ps-vector vector-map3!))"; \
  31. echo " '(copy (ps-vector vector-map1))"; \
  32. echo " '(copy (ps-vector vector-map2))"; \
  33. echo " '(copy (ps-vector vector-map3))"; \
  34. echo " '(copy (ps-vector vector-for-each1))"; \
  35. echo " '(copy (ps-vector vector-for-each2))"; \
  36. echo " '(copy (ps-vector vector-for-each3))"; \
  37. echo ")"; \
  38. echo ",exit" ) \
  39. | $(PRESCHEME)
  40. $(FORMAT) $@
  41. clean:
  42. rm -f $(TARGETS)
  43. rm -f $(TARGETS:=.o)
  44. rm -f $(TARGETS:=.c)
  45. .PRECIOUS: $(TARGETS:=.c)
  46. .PHONY: all clean