You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

common.am 4.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #
  2. # Define these variables from the beginning
  3. #
  4. CLEANFILES =
  5. SUFFIXES =
  6. EXTRA_DIST =
  7. #
  8. # Miscellaneous rules
  9. #
  10. lol_recursive_rule = \
  11. @if test -n "$(SUBDIRS)"; then for subdir in $(SUBDIRS); do \
  12. ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $(patsubst %-recursive, %, $@)) || exit 1; \
  13. done; fi
  14. bench: bench-recursive
  15. bench-recursive:
  16. $(lol_recursive_rule)
  17. lolcheck: lolcheck-recursive
  18. lolcheck-recursive:
  19. $(lol_recursive_rule)
  20. #
  21. # Flex and Bison files build rule
  22. #
  23. generated: generated-recursive
  24. generated-recursive:
  25. $(lol_recursive_rule)
  26. @if test -n "$(filter %-scanner.l, $(EXTRA_DIST))"; then \
  27. echo $(MKDIR_P) generated; \
  28. $(MKDIR_P) generated; \
  29. rm -f generated/[a-zA-Z]*; \
  30. for scanner in $(patsubst %-scanner.l, %, $(filter %-scanner.l, $(EXTRA_DIST))); do \
  31. b="`basename $$scanner`"; \
  32. echo flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l"; \
  33. flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l" || exit 1; \
  34. done; \
  35. for parser in $(patsubst %-parser.y, %, $(filter %-parser.y, $(EXTRA_DIST))); do \
  36. b="`basename $$parser`"; \
  37. echo bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y"; \
  38. bison -o "generated/$$b-parser.cpp" --defines="generated/$$b-parser.h" -d -b "generated/$$b" "$$parser-parser.y" || exit 1; \
  39. done; \
  40. fi
  41. #
  42. # .lolfx build rule
  43. #
  44. lolfx_gen = $(lolfx_gen_$(V))
  45. lolfx_gen_ = $(lolfx_gen_$(AM_DEFAULT_VERBOSITY))
  46. lolfx_gen_0 = @echo " LOLFX " $@;
  47. SUFFIXES += .lolfx
  48. .lolfx.o:
  49. $(lolfx_gen)
  50. $(AM_V_at)(echo "char const *"; \
  51. echo "lolfx_resource_$(notdir $(basename $(filter %.lolfx, $^))) ="; \
  52. $(SED) 's/"/\\"/g' $(filter %.lolfx, $^) | $(SED) 's/\([^\r]*\).*/"\1\\n"/'; \
  53. echo ";") \
  54. | $(CXXCOMPILE) -xc++ -c - -o $@
  55. #
  56. # PS3 fself support rules
  57. #
  58. fself_gen = $(fself_gen_$(V))
  59. fself_gen_ = $(fself_gen_$(AM_DEFAULT_VERBOSITY))
  60. fself_gen_0 = echo " FSELF " $${x}.self;
  61. fself_gen_1 = echo make_fself $${x}$(EXEEXT) $${x}.self;
  62. all-local: all-local-ps3
  63. all-local-ps3: $(PROGRAMS) $(noinst_PROGRAMS)
  64. @if test -n "$^"; then for x in $(^:%$(EXEEXT)=%); do \
  65. if test x$(MAKE_FSELF) != xno; then \
  66. $(fself_gen) \
  67. make_fself $${x}$(EXEEXT) $${x}.self; \
  68. fi; \
  69. done; fi
  70. CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.self) \
  71. $(PROGRAMS:%$(EXEEXT)=%.elf) \
  72. $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \
  73. $(noinst_PROGRAMS:%$(EXEEXT)=%.elf)
  74. #
  75. # Win32 rules
  76. #
  77. # This is here in case we forget to make clean after a Windows build
  78. CLEANFILES += $(PROGRAMS:%$(EXEEXT)=%.exe) \
  79. $(noinst_PROGRAMS:%$(EXEEXT)=%.exe)
  80. #
  81. # Android rules
  82. #
  83. all-local: all-local-android
  84. clean-local: clean-local-android
  85. if USE_ANDROID
  86. all-local-android: $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), $($(p)_DATA))
  87. $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), \
  88. rm -rf "android-$(p)"; \
  89. $(MKDIR_P) "android-$(p)" $(sort $(foreach f, $($(p)_DATA), "android-$(p)/assets/$(dir $(f))")); \
  90. $(foreach f, $($(p)_DATA), $(LN_S) "$(abs_srcdir)/$(f)" "android-$(p)/assets/$(f)";) \
  91. $(SED) -e 's,@PROGRAM@,$(p),' "$(top_srcdir)/build/android/AndroidManifest.xml" > "android-$(p)/AndroidManifest.xml"; \
  92. $(MKDIR_P) "android-$(p)/src/net/lolengine"; \
  93. $(SED) -e 's,@PROGRAM@,$(p),' "$(top_srcdir)/build/android/LolActivity.java" > "android-$(p)/src/net/lolengine/LolActivity.java"; \
  94. $(MKDIR_P) "android-$(p)/res/values"; \
  95. $(SED) -e 's,@PROGRAM@,$(p),' "$(top_srcdir)/build/android/strings.xml" > "android-$(p)/res/values/strings.xml"; \
  96. $(MKDIR_P) "android-$(p)/res/drawable"; \
  97. cp "$(top_srcdir)/build/android/icon.png" "android-$(p)/res/drawable/"; \
  98. $(MKDIR_P) "android-$(p)/libs/armeabi"; \
  99. $(LN_S) "$(abs_builddir)/$(p).so" "android-$(p)/libs/armeabi/lib$(p).so"; \
  100. $(LN_S) "$${ANDROID_NDK_ROOT}/sources/cxx-stl/stlport/libs/armeabi/libstlport_shared.so" "android-$(p)/libs/armeabi"; \
  101. android update project -t android-8 -p "android-$(p)"; \
  102. ant debug -f "android-$(p)/build.xml"; \
  103. )
  104. else
  105. all-local-android:
  106. endif
  107. clean-local-android:
  108. $(foreach p, $(PROGRAMS:%$(EXEEXT)=%), rm -rf "android-$(p)";)
  109. #
  110. # Additional rules
  111. #
  112. EXTRA_DIST += $(foreach p, $(PROGRAMS), $($(p)_DATA))
  113. .PHONY: bench lolcheck generated