2
0

Makefile 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Where we find the current runnable code and where we put our js files when we are done
  2. JS := ../js/
  3. # The compiler script
  4. JTALKC := ../bin/jtalkc
  5. # Generic flags to JTALKC
  6. FLAGS := -g
  7. # The js files that are hand written and we use "as is"
  8. CORE := boot.js init.js
  9. # All corresponding js filenames for every st file available
  10. # In other words, if we have Kernel.st and Parser.st, then OBJECTS will be "Kernel.js Parser.js"
  11. OBJECTS := $(patsubst %.st,%.js,$(wildcard *.st))
  12. # Default make targets
  13. all: jtalk.deploy.js jtalk.js
  14. # Step by step
  15. #
  16. # First we copy the core javascript files from current working files
  17. # into this directory. These files are hand written.
  18. boot.js:
  19. cp ../js/boot.js ../js/init.js .
  20. # Then we compile Kernel.st using boot.js, Kernel.js, init.js
  21. # $< means the first dependency - in other words Kernel.st
  22. Kernel.js: Kernel.st $(CORE)
  23. $(JTALKC) $(FLAGS) $<
  24. # ...then Parser, but using the new Kernel from step above.
  25. # We only need to depend on Kernel.js since it in turn depends on CORE.
  26. Parser.js: Parser.st Kernel.js
  27. $(JTALKC) $(FLAGS) $<
  28. # ...and Compiler, but using the new Parser and Kernel from above.
  29. # We only need to depend on Parser.js since it in turn depends on Kernel.js, CORE etc
  30. Compiler.js: Compiler.st Parser.js
  31. $(JTALKC) $(FLAGS) $<
  32. # ...now that we have a new Kernel/Parser/Compiler we use them
  33. # to compile the rest of st files that only depend on Compiler, like
  34. # for example Canvas.js and Benchfib.js
  35. %.js: %.st Compiler.js
  36. $(JTALKC) $(FLAGS) $<
  37. # But there are some dependencies to care for:
  38. # JQuery uses Canvas
  39. JQuery.js: JQuery.st Canvas.js
  40. $(JTALKC) $(FLAGS) -l Canvas.js $<
  41. # IDE uses JQuery
  42. IDE.js: IDE.st JQuery.js
  43. $(JTALKC) $(FLAGS) -l Canvas.js,JQuery.js $<
  44. # The SUnit TestRunner uses UI stuff from IDE.
  45. SUnit.js: SUnit.st IDE.js
  46. $(JTALKC) $(FLAGS) -l Canvas.js,JQuery.js,IDE.js $<
  47. # Some Examples use SUnit
  48. Examples.js: Examples.st SUnit.js
  49. $(JTALKC) $(FLAGS) -l Canvas.js,JQuery.js,IDE.js,SUnit.js $<
  50. # Complete Jtalk, here we give -J (will include all libs for Jtalk IDE),
  51. # push it all through Closure (-O) and add init.js at end (-I).
  52. jtalk.js: $(OBJECTS)
  53. $(JTALKC) -J -O -I jtalk
  54. # Only Jtalk Kernel and compiled without -g. Thus we need to clean first to remake
  55. # all dependencies with new FLAGS.
  56. # Then we give -K (will include up to Compiler), push it all through Closure (-O)
  57. # and add init.js at end (-I).
  58. jtalk.deploy.js: FLAGS =
  59. jtalk.deploy.js: cleanobjects $(OBJECTS)
  60. $(JTALKC) -K -O -I jtalk.deploy.js
  61. # Installing is simply copying all js files to js directory.
  62. install: all
  63. cp *.js $(JS)
  64. # And cleaning
  65. clean: cleanobjects cleanjtalk
  66. .PHONY: cleanobjects
  67. cleanobjects:
  68. rm -f $(OBJECTS)
  69. .PHONY: cleanjtalk
  70. cleanjtalk:
  71. rm -f jtalk.js jtalk.deploy.js