Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # If you copy this file for an Android Amber project, just
  3. # modify these first three lines
  4. # and then add .st files as you please. This Makefile
  5. # should pick them all up and compile into Program.js.
  6. #
  7. NAME := HelloAmber
  8. PACKAGE := org.amberlang.android.helloamber
  9. ACTIVITY := HelloAmber
  10. # debug or release
  11. VERSION := debug
  12. # -O for Closure optimization of js code.
  13. FLAGS :=
  14. APK := bin/$(NAME)-$(VERSION).apk
  15. FILE := Program
  16. SOURCES := $(wildcard *.st)
  17. OBJECTS := $(patsubst %.st,%.js,$(wildcard *.st))
  18. FILEJS := assets/$(FILE).js
  19. # Find files that match a wildcard pattern recursively
  20. rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
  21. JAVA_SOURCES := $(call rwildcard,src/,*.java)
  22. ASSETS := $(call rwildcard,assets/,*)
  23. all: $(APK)
  24. $(FILEJS): $(SOURCES)
  25. ../../../bin/amberc $(FLAGS) $(SOURCES) $(FILE)
  26. mv $(FILE).js $(FILEJS)
  27. $(APK): $(FILEJS) $(ASSETS) $(JAVA_SOURCES) AndroidManifest.xml build.xml
  28. ant $(VERSION)
  29. clean:
  30. rm -f $(FILEJS) $(OBJECTS) $(APK)
  31. rm -rf gen bin
  32. install: $(APK)
  33. adb install $(APK)
  34. # If you want to run it in the emulator, start the emulator first with the
  35. # android command.
  36. run: $(APK)
  37. adb install -r $(APK)
  38. adb shell am start -n $(PACKAGE)/$(PACKAGE).$(ACTIVITY)
  39. # This should fire it up in Chromium (at least under Ubuntu)
  40. chromium: $(FILEJS)
  41. chromium-browser --allow-file-access-from-files assets/index.html