source: trunk/build/autotools/common.am @ 2576

Last change on this file since 2576 was 2576, checked in by sam, 8 years ago

build: big Android build system refactor; we now attempt to build
an apk for each project.

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