2
0

Makefile 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #
  2. # This Makefile takes .st files in the jtalk/st directory and produces compiled
  3. # javascript files from them, for both debug and deployment.
  4. #
  5. # Where we find the current runnable code and where we put our js files on install
  6. JS := ../js/
  7. # The compiler script
  8. JTALKC := ../bin/jtalkc
  9. # Generic flags to JTALKC
  10. FLAGS := -d
  11. # All corresponding js filenames for every st file available
  12. # In other words, if we have Kernel.st and Parser.st, then OBJECTS will be "Kernel.js Parser.js"
  13. OBJECTS := $(patsubst %.st,%.js,$(wildcard *.st))
  14. # Default make target since it is the first target in this Makefile
  15. all: Examples.js
  16. # Step by step
  17. #
  18. # First we copy the core javascript files from current working files
  19. # into this directory. These files are hand written. $@ is the target name.
  20. boot.js init.js:
  21. cp ../js/$@ .
  22. # Then we compile Kernel.st depending on having using boot.js and init.js
  23. # $< means the first dependency - in other words Kernel.st
  24. Kernel.js: Kernel.st boot.js init.js
  25. $(JTALKC) $(FLAGS) $<
  26. # ...then Parser, but using the new Kernel from step above.
  27. # We only need to depend on Kernel.js since it in turn depends on boot.js and init.js.
  28. Parser.js: Parser.st Kernel.js
  29. $(JTALKC) $(FLAGS) $<
  30. # ...and Compiler, but using the new Parser and Kernel from above.
  31. # We only need to depend on Parser.js since it in turn depends on Kernel.js, boot.js etc
  32. Compiler.js: Compiler.st Parser.js
  33. $(JTALKC) $(FLAGS) $<
  34. # ...now that we have a new Kernel/Parser/Compiler we use them
  35. # to compile the rest of st files presuming that they only depend on Compiler, like
  36. # for example Canvas.js and Benchfib.js.
  37. %.js: %.st Compiler.js
  38. $(JTALKC) $(FLAGS) $<
  39. # But for some libraries there are dependencies to care for. Then
  40. # we need to use -l so that the compiler first loads that library
  41. # before compiling the .st file. Otherwise bindings will fail.
  42. #
  43. # JQuery uses Canvas
  44. JQuery.js: JQuery.st Canvas.js
  45. $(JTALKC) $(FLAGS) -l Canvas $<
  46. # IDE uses JQuery
  47. IDE.js: IDE.st JQuery.js
  48. $(JTALKC) $(FLAGS) -l Canvas,JQuery $<
  49. # The SUnit TestRunner uses UI stuff from IDE.
  50. SUnit.js: SUnit.st IDE.js
  51. $(JTALKC) $(FLAGS) -l Canvas,JQuery,IDE $<
  52. # Some Examples use SUnit
  53. Examples.js: Examples.st SUnit.js
  54. $(JTALKC) $(FLAGS) -l Canvas,JQuery,IDE,SUnit $<;
  55. # Installing is simply copying all js files to js directory.
  56. install: all
  57. cp *.js $(JS)
  58. # And cleaning is trivial also
  59. clean:
  60. rm -f *.js;
  61. # These three are phony
  62. .PHONY: all install clean