libandroidplugin added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VP_SDK / Build / varcontrol.makefile
1
2 ###########################################################################################
3 #
4 # Controls validity of variables values
5 # ----------------------------------------------------------------------------------
6 # Author : aurelien.morelle@parrot.com
7 # Date   : 2007/05/16
8 #
9 # Included from global Makefile
10 #
11 ###########################################################################################
12
13 #
14 # Control macros
15 ###################################################
16
17 define EXIT_IF_ERROR
18   ifeq "$$(ERROR)" "1"
19     $$(error There has been some errors)
20   endif
21 endef
22
23 define CHECK_DEFINITION
24   ifndef $(1)
25     $$(warning ERROR : $(1) undefined $(2))
26     ERROR=1
27   endif
28 endef
29
30 define CHECK_YES_NO
31   ifneq "$$($(1))" "yes"
32   ifneq "$$($(1))" "no"
33     $$(warning ERROR : $(1) must be set to "yes" or "no")
34     ERROR=1
35   endif
36   endif
37 endef
38
39 define CHECK_VALUE
40   ifneq "$$($(1))" "$(2)"
41     $$(warning ERROR : $(1) must be set to "$(2)" when $(3))
42     ERROR=1
43   endif
44 endef
45
46 define CHECK_TWO_VALUES
47   ifneq "$$($(1))" "$(2)"
48     ifneq "$$($(1))" "$(3)"
49       $$(warning ERROR : $(1) must be set to "$(2)" or "$(3)" when $(4))
50       ERROR=1
51     endif
52   endif
53 endef
54
55 define CHECK_DIR
56   ifeq ($$(wildcard $(1)),)
57     $$(warning ERROR Bad $(2) : "$$($(2))" [ $(1) does not exist ])
58     ERROR=1
59   endif
60 endef
61
62 #
63 # All that need to be defined
64 ###################################################
65
66 ifeq "$(USE_ELINUX)" "yes"
67 $(eval $(call CHECK_DEFINITION,ALL_SOURCES,: should be defined as an environment variable.))
68 $(eval $(call CHECK_DEFINITION,ALL_TARGETS,: should be defined as an environment variable.))
69 $(eval $(call CHECK_DEFINITION,LINUX_CONFIG_PATH,: should be defined as an environment variable.))
70 endif 
71 $(eval $(call CHECK_DEFINITION,USE_ANDROID,: should be "yes" or "no"))
72 $(eval $(call CHECK_DEFINITION,USE_LINUX,: should be "yes" or "no"))
73 $(eval $(call CHECK_DEFINITION,USE_ELINUX,: should be "yes" or "no"))
74 $(eval $(call CHECK_DEFINITION,USE_NDS,: should be "yes" or "no"))
75 $(eval $(call CHECK_DEFINITION,USE_IPHONE,: should be "yes" or "no"))
76 $(eval $(call CHECK_DEFINITION,NO_COM,: should be "yes" or "no"))
77 $(eval $(call CHECK_DEFINITION,USE_BLUEZ,: should be "yes" or "no"))
78 $(eval $(call CHECK_DEFINITION,USE_VLIB,: should be "yes" or "no"))
79 $(eval $(call CHECK_DEFINITION,RELEASE_BUILD,: should be "yes" or "no"))
80 $(eval $(call CHECK_DEFINITION,USE_SDK,: should be "yes" or "no"))
81 $(eval $(call CHECK_DEFINITION,USE_APP,: should be "yes" or "no"))
82 $(eval $(call CHECK_DEFINITION,NO_EXAMPLES,: should be "yes" or "no"))
83 #
84 #ifeq "$(USE_SDK)" "yes"
85 #  $(eval $(call CHECK_DEFINITION,SDK_VERSION,( example : "head" )))
86 #endif
87
88 ifeq "$(USE_ELINUX)" "yes"
89   $(eval $(call CHECK_DEFINITION,TOOLCHAIN_VERSION,( example : "arm-uclibc" )))
90   $(eval $(call CHECK_DEFINITION,USE_PARROTOS_CORE,: should be "yes" or "no"))
91 endif
92
93 ifeq "$(USE_NDS)" "yes"
94   $(eval $(call CHECK_DEFINITION,NDS_CPU,: should be "ARM7" or "ARM9"))
95 endif
96
97 ifeq "$(USE_BONJOUR)" "yes"
98   $(eval $(call CHECK_DEFINITION,BONJOUR_VERSION,( example : "head" )))
99 endif
100
101 $(eval $(call EXIT_IF_ERROR))
102
103 ifeq "$(USE_APP)" "yes"
104 ifndef PARROTOS_MAKEFILE
105   $(eval $(call CHECK_DEFINITION,GENERIC_BINARIES_SOURCE_DIR,))
106   $(eval $(call CHECK_DEFINITION,GENERIC_BINARIES_SOURCE_DIR,))
107   $(eval $(call CHECK_DEFINITION,GENERIC_TARGET_BINARIES_DIR,))
108   $(eval $(call CHECK_DEFINITION,GENERIC_BINARIES_SOURCE_ENTRYPOINTS,))
109 endif
110 endif
111
112 #
113 # Validity test
114 ###################################################
115 $(eval $(call CHECK_YES_NO,USE_ANDROID))
116 $(eval $(call CHECK_YES_NO,USE_LINUX))
117 $(eval $(call CHECK_YES_NO,USE_ELINUX))
118 $(eval $(call CHECK_YES_NO,USE_NDS))
119 $(eval $(call CHECK_YES_NO,USE_IPHONE))
120
121 $(eval $(call CHECK_YES_NO,NO_COM))
122 $(eval $(call CHECK_YES_NO,USE_BLUEZ))
123 $(eval $(call CHECK_YES_NO,USE_SDK))
124 $(eval $(call CHECK_YES_NO,USE_APP))
125 $(eval $(call CHECK_YES_NO,USE_VLIB))
126 $(eval $(call CHECK_YES_NO,NO_EXAMPLES))
127 $(eval $(call CHECK_YES_NO,RELEASE_BUILD))
128 $(eval $(call CHECK_YES_NO,USE_ARDRONELIB))
129 $(eval $(call CHECK_YES_NO,USE_ARDRONE_VISION))
130 $(eval $(call CHECK_YES_NO,USE_ARDRONE_POLARIS))
131 $(eval $(call CHECK_YES_NO,USE_ARDRONE_VICON))
132 $(eval $(call CHECK_YES_NO,USE_ARDRONE_TEST_BENCHS))
133 $(eval $(call CHECK_YES_NO,USE_ARDRONE_CALIBRATION))
134
135 ifeq "$(USE_ELINUX)" "yes"
136   $(eval $(call CHECK_YES_NO,USE_PARROTOS_CORE))
137   ifneq "$(TOOLCHAIN_VERSION)" "arm-uclibc"
138   ifneq "$(TOOLCHAIN_VERSION)" "arm-eglibc"
139   ifneq "$(TOOLCHAIN_VERSION)" "arm-2010.09"
140     $(warning ERROR Bad TOOLCHAIN_VERSION : must be "arm-uclibc", "arm-eglibc", or "arm-2010.09")
141     ERROR=1
142   endif
143   endif
144   endif
145 endif
146
147 ifeq "$(USE_NDS)" "yes"
148   ifneq "$(NDS_CPU)" "ARM7"
149   ifneq "$(NDS_CPU)" "ARM9"
150     $(warning ERROR Bad NDS_CPU : must be "ARM7" or "ARM9")
151     ERROR=1
152   endif
153   endif
154 endif
155
156 $(eval $(call EXIT_IF_ERROR))
157
158 #
159 # Compatibility test
160 ###################################################
161 ifeq "$(USE_ANDROID)" "yes"
162   $(eval $(call CHECK_DEFINITION,NDK_PATH,: should be defined as an environment variable.))
163   $(eval $(call CHECK_VALUE,USE_LINUX,no,android is used))
164   $(eval $(call CHECK_VALUE,USE_NDS,no,android is used))
165   $(eval $(call CHECK_VALUE,USE_ELINUX,no,android is used))
166   $(eval $(call CHECK_VALUE,USE_PARROTOS_CORE,no,android is used (parrotos is available only on elinux)))
167   $(eval $(call CHECK_VALUE,USE_IPHONE,no,android is used))
168 endif
169
170 ifeq "$(USE_APP)" "yes"
171   $(eval $(call CHECK_DEFINITION,APP_ID,(example : "ardrone")))
172 endif
173 ifeq "$(USE_SDK)" "yes"
174   $(eval $(call CHECK_DIR,$(ALL_SOURCES)/$(SDK_SOURCE_DIR),SDK_VERSION))
175   $(eval $(call EXIT_IF_ERROR))
176   #Disabled by Stephane - this is probably deprecated
177   #ifeq "$(USE_FFMPEG)" "yes"
178   #  $(eval $(call CHECK_DIR,$(ALL_SOURCES)/$(SDK_SOURCE_DIR)/PFFMPEG/$(FF_ARCH),FF_ARCH))
179   #endif
180 endif
181 ifeq "$(USE_BONJOUR)" "yes"
182    $(eval $(call CHECK_DIR,$(ALL_SOURCES)/bonjour/$(BONJOUR_VERSION)/Bonjour,BONJOUR_VERSION))
183 endif
184
185 ifeq "$(USE_LINUX)" "yes"
186   $(eval $(call CHECK_VALUE,USE_ANDROID,no,linux is used))
187   $(eval $(call CHECK_VALUE,USE_ELINUX,no,linux is used))
188   $(eval $(call CHECK_VALUE,USE_NDS,no,linux is used))
189   $(eval $(call CHECK_VALUE,USE_PARROTOS_CORE,no,linux is used (parrotos is available only on elinux)))
190   $(eval $(call CHECK_VALUE,USE_IPHONE,no,linux is used))
191 endif
192
193 ifeq "$(USE_ELINUX)" "yes"
194   $(eval $(call CHECK_VALUE,USE_ANDROID,no,linux is used))
195   $(eval $(call CHECK_DIR,$(ALL_SOURCES)/commonsoft/$(COMMONSOFT_VERSION)/CommonSoft,COMMONSOFT_VERSION))
196   $(eval $(call CHECK_VALUE,USE_LINUX,no,embedded linux is used))
197   $(eval $(call CHECK_VALUE,USE_NDS,no,embedded linux is used))
198   $(eval $(call CHECK_VALUE,USE_IPHONE,no,embedded linux is used))
199 endif
200
201 ifeq "$(USE_NDS)" "yes"
202   $(eval $(call CHECK_VALUE,USE_ANDROID,no,linux is used))
203   $(eval $(call CHECK_VALUE,USE_LINUX,no,nintendo ds is used))
204   $(eval $(call CHECK_VALUE,USE_ELINUX,no,nintendo ds is used))
205   $(eval $(call CHECK_VALUE,USE_PARROTOS_CORE,no,nintendo ds is used (parrotos is available only on elinux)))
206   $(eval $(call CHECK_VALUE,USE_IPHONE,no,nintendo ds is used))
207 endif
208
209
210 ifeq "$(USE_IPHONE)" "yes"
211   $(eval $(call CHECK_VALUE,USE_ANDROID,no,linux is used))
212   $(eval $(call CHECK_DEFINITION,IPHONE_SDK_PATH,(example : "path to sdk")))
213   $(eval $(call CHECK_DEFINITION,IPHONE_PLATFORM,(example : "iphoneos or iphonesimulator")))
214   $(eval $(call CHECK_VALUE,USE_NDS,no,iphone is used))
215   $(eval $(call CHECK_VALUE,USE_LINUX,no,iphone is used))
216   $(eval $(call CHECK_VALUE,USE_ELINUX,no,iphone is used))
217   $(eval $(call CHECK_VALUE,USE_PARROTOS_CORE,no,iphone is used (parrotos is available only on elinux)))
218   $(eval $(call CHECK_TWO_VALUES,IPHONE_PLATFORM,iphoneos,iphonesimulator, IPHONE_PLATFORM must be set to iphoneos or iphonesimulator))
219 endif
220
221 $(eval $(call CHECK_VALUE,USE_BONJOUR,no,ecos is not used))
222
223 ifeq "$(NO_COM)" "yes"
224   $(eval $(call CHECK_VALUE,USE_BLUEZ,no,NO_COM is used))
225 endif
226
227 ifeq "$(USE_BROADCOM)" "yes"
228   $(eval $(call CHECK_VALUE,USE_IWLIB,no,BROADCOM is used))
229 endif
230
231 ifeq "$(USE_IWLIB)" "yes"
232   $(eval $(call CHECK_VALUE,USE_BROADCOM,no,iwlib is used))
233 endif
234
235 $(eval $(call EXIT_IF_ERROR))
236