2
0

Makefile 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #
  2. # This Makefile takes .st files in the amber/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. AMBERC := ../bin/amberc
  9. # Generic flags to AMBERC
  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 files depending on having boot.js, init.js and parser.js
  24. # $< means the first dependency - in other words Kernel-*.st
  25. Kernel-Objects.js: Kernel-Objects.st boot.js init.js parser.js
  26. $(AMBERC) $(FLAGS) $<
  27. Kernel-Classes.js: Kernel-Classes.st boot.js init.js parser.js
  28. $(AMBERC) $(FLAGS) $<
  29. Kernel-Methods.js: Kernel-Methods.st boot.js init.js parser.js
  30. $(AMBERC) $(FLAGS) $<
  31. Kernel-Collections.js: Kernel-Collections.st boot.js init.js parser.js
  32. $(AMBERC) $(FLAGS) $<
  33. Kernel-Exceptions.js: Kernel-Exceptions.st boot.js init.js parser.js
  34. $(AMBERC) $(FLAGS) $<
  35. Kernel-Transcript.js: Kernel-Transcript.st boot.js init.js parser.js
  36. $(AMBERC) $(FLAGS) $<
  37. # ...and Compiler, but using the new Kernel from above.
  38. # We only need to depend on Kernel js files since it in turn depends on boot.js etc
  39. Compiler.js: Compiler.st Kernel-Objects.js Kernel-Classes.js Kernel-Methods.js Kernel-Collections.js \
  40. Kernel-Exceptions.js Kernel-Transcript.js
  41. $(AMBERC) $(FLAGS) $<
  42. # ...now that we have a new Kernel and Compiler we use them
  43. # to compile the rest of st files presuming that they only depend on Kernel, like
  44. # for example Canvas.js and Benchfib.js.
  45. %.js: %.st Compiler.js
  46. $(AMBERC) $(FLAGS) $<
  47. # But for some libraries there are more dependencies to care for. Then
  48. # we need to use -l so that the compiler first loads that library
  49. # before compiling the .st file. Otherwise bindings will fail.
  50. #
  51. # NOTE: With the new dependency model in class Package etc this will change!
  52. #
  53. Canvas.js: Canvas.st
  54. $(AMBERC) $(FLAGS) $<
  55. # IDE uses JQuery
  56. IDE.js: IDE.st Canvas.js
  57. $(AMBERC) $(FLAGS) -l Canvas $<
  58. TrySmalltalk.js: TrySmalltalk.st IDE.js
  59. $(AMBERC) $(FLAGS) -l Canvas,IDE $<
  60. # Some Examples use SUnit and also IDE
  61. Examples.js: Examples.st SUnit.js IDE.js
  62. $(AMBERC) $(FLAGS) -l SUnit,Canvas,IDE $<
  63. # Tests typically also use SUnit
  64. Kernel-Tests.js: Kernel-Tests.st SUnit.js
  65. $(AMBERC) $(FLAGS) -l SUnit $<
  66. # Documentation
  67. Documentation.js: Documentation.st Canvas.js
  68. $(AMBERC) $(FLAGS) -l Canvas $<;
  69. # Installing is simply copying all js files to js directory.
  70. install: all
  71. cp *.js $(JS)
  72. # And cleaning is trivial also
  73. clean:
  74. rm -f *.js
  75. # These three are phony
  76. .PHONY: all install clean