2
0

Makefile 3.1 KB

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