1
0

Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 Compiler.st, then OBJECTS will be "Kernel.js Compiler.js"
  13. OBJECTS := $(patsubst %.st,%.js,$(wildcard *.st))
  14. # Default make target since it is the first target in this Makefile
  15. all: $(OBJECTS)
  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 or generated using
  20. # other tools (parser.js). $@ is the target name.
  21. boot.js init.js parser.js:
  22. cp ../js/$@ .
  23. # Then we compile Kernel.st depending on having boot.js, init.js and parser.js
  24. # $< means the first dependency - in other words Kernel.st
  25. Kernel.js: Kernel.st boot.js init.js parser.js
  26. $(JTALKC) $(FLAGS) $<
  27. # ...and Compiler, but using the new Kernel from above.
  28. # We only need to depend on Kernel.js since it in turn depends on boot.js etc
  29. Compiler.js: Compiler.st Kernel.js
  30. $(JTALKC) $(FLAGS) $<
  31. # ...now that we have a new Kernel and Compiler we use them
  32. # to compile the rest of st files presuming that they only depend on Kernel, like
  33. # for example Canvas.js and Benchfib.js.
  34. %.js: %.st Compiler.js
  35. echo $(OBJECTS)
  36. $(JTALKC) $(FLAGS) $<
  37. # But for some libraries there are more dependencies to care for. Then
  38. # we need to use -l so that the compiler first loads that library
  39. # before compiling the .st file. Otherwise bindings will fail.
  40. #
  41. # NOTE: With the new dependency model in class Package etc this will change!
  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. TrySmalltalk.js: TrySmalltalk.st IDE.js
  50. $(JTALKC) $(FLAGS) -l Canvas,JQuery,IDE $<
  51. # Some Examples use SUnit and also IDE
  52. Examples.js: Examples.st SUnit.js IDE.js
  53. $(JTALKC) $(FLAGS) -l SUnit,Canvas,JQuery,IDE $<;
  54. # Tests typically also use SUnit
  55. Kernel-Tests.js: Kernel-Tests.st SUnit.js
  56. $(JTALKC) $(FLAGS) -l SUnit $<;
  57. # Tests typically also use SUnit
  58. JQuery-Tests.js: JQuery-Tests.st JQuery.js SUnit.js
  59. $(JTALKC) $(FLAGS) -l Canvas,JQuery,SUnit $<;
  60. # Installing is simply copying all js files to js directory.
  61. install: all
  62. cp *.js $(JS)
  63. # And cleaning is trivial also
  64. clean:
  65. rm -f *.js;
  66. # These three are phony
  67. .PHONY: all install clean