blob: b81b475f2acbd552a11176d8f1a03889bb333817 [file] [log] [blame]
David 'Digit' Turneraff94b82011-02-07 18:10:54 +01001# When building this project, we actually generate several components which
2# are the following:
3#
4# - the emulator-ui program (which is target-agnostic)
5# - the target-specific qemu-android-$ARCH programs (headless emulation engines)
6# - the "standalone" emulator programs (embed both UI and engine in a single
7# binary and process), i.e. "emulator" for ARM and "emulator-x86" for x86.
8#
9# This file defines static host libraries that will be used by at least two
10# of these components.
11#
12
13##############################################################################
14##############################################################################
15###
David 'Digit' Turner42fc4492011-06-29 13:16:16 +020016### gen-hw-config-defs: Generate hardware configuration definitions header
17###
18### The 'gen-hw-config.py' script is used to generate the hw-config-defs.h
19### header from the an .ini file like android/avd/hardware-properties.ini
20###
21### Due to the way the Android build system works, we need to regenerate
22### it for each module (the output will go into a module-specific directory).
23###
24### This defines a function that can be used inside a module definition
25###
26### $(call gen-hw-config-defs)
27###
28
29# First, define a rule to generate a dummy "emulator_hw_config_defs" module
30# which purpose is simply to host the generated header in its output directory.
31intermediates := $(call intermediates-dir-for,SHARED_LIBRARIES,emulator_hw_config_defs,true)
32
33QEMU_HARDWARE_PROPERTIES_INI := $(LOCAL_PATH)/android/avd/hardware-properties.ini
34QEMU_HW_CONFIG_DEFS_H := $(intermediates)/android/avd/hw-config-defs.h
35$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_PATH := $(LOCAL_PATH)
36$(QEMU_HW_CONFIG_DEFS_H): PRIVATE_CUSTOM_TOOL = $(LOCAL_PATH)/android/tools/gen-hw-config.py $< $@
37$(QEMU_HW_CONFIG_DEFS_H): $(QEMU_HARDWARE_PROPERTIES_INI) $(LOCAL_PATH)/android/tools/gen-hw-config.py
38 $(hide) rm -f $@
39 $(transform-generated-source)
40
41QEMU_HW_CONFIG_DEFS_INCLUDES := $(intermediates)
42
43# Second, define a function that needs to be called inside each module that contains
44# a source file that includes the generated header file.
45gen-hw-config-defs = \
46 $(eval LOCAL_GENERATED_SOURCES += $(QEMU_HW_CONFIG_DEFS_H))\
47 $(eval LOCAL_C_INCLUDES += $(QEMU_HW_CONFIG_DEFS_INCLUDES))
48
49##############################################################################
50##############################################################################
51###
David 'Digit' Turneraff94b82011-02-07 18:10:54 +010052### emulator-common: LIBRARY OF COMMON FUNCTIONS
53###
54### THESE ARE POTENTIALLY USED BY ALL COMPONENTS
55###
56
57$(call start-emulator-library, emulator-common)
58
59EMULATOR_COMMON_CFLAGS :=
60
61# Needed by everything about the host
62EMULATOR_COMMON_CFLAGS += \
63 -I$(LOCAL_PATH)/android/config/$(QEMU_HOST_TAG)
64
65# add the build ID to the default macro definitions
66ifeq ($(BUILD_STANDALONE_EMULATOR),)
67EMULATOR_COMMON_CFLAGS += -DANDROID_BUILD_ID="$(strip $(BUILD_ID))-$(strip $(BUILD_NUMBER))"
68endif
69
70# For non-standalone builds, extract the major version number from the Android SDK
71# tools revision number.
72ifneq ($(BUILD_STANDALONE_EMULATOR),true)
73 ANDROID_SDK_TOOLS_REVISION := $(shell awk -F= '/Pkg.Revision/ { print $$2; }' sdk/files/tools_source.properties)
74endif
75
76ANDROID_SDK_TOOLS_REVISION := $(strip $(ANDROID_SDK_TOOLS_REVISION))
77ifdef ANDROID_SDK_TOOLS_REVISION
78 EMULATOR_COMMON_CFLAGS += -DANDROID_SDK_TOOLS_REVISION=$(ANDROID_SDK_TOOLS_REVISION)
79endif
80
81# Enable large-file support (i.e. make off_t a 64-bit value)
82ifeq ($(HOST_OS),linux)
83EMULATOR_COMMON_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
84endif
85
86###########################################################
87# Zlib sources
88#
89ZLIB_DIR := distrib/zlib-1.2.3
90include $(LOCAL_PATH)/$(ZLIB_DIR)/sources.make
91EMULATOR_COMMON_CFLAGS += -I$(LOCAL_PATH)/$(ZLIB_DIR)
92
93LOCAL_SRC_FILES += $(ZLIB_SOURCES)
94
95###########################################################
96# Android utility functions
97#
98LOCAL_SRC_FILES += \
99 sockets.c \
100 iolooper-select.c \
101 android/async-console.c \
102 android/async-utils.c \
103 android/charmap.c \
104 android/framebuffer.c \
105 android/keycode-array.c \
106 android/avd/hw-config.c \
107 android/avd/info.c \
David 'Digit' Turner2d238fd2011-03-25 10:34:47 +0100108 android/avd/util.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100109 android/sync-utils.c \
110 android/utils/assert.c \
111 android/utils/bufprint.c \
112 android/utils/debug.c \
113 android/utils/dirscanner.c \
114 android/utils/filelock.c \
115 android/utils/ini.c \
David 'Digit' Turnerbbb81042011-03-17 14:48:44 +0100116 android/utils/intmap.c \
David 'Digit' Turner0a879bf2011-05-12 18:45:18 +0200117 android/utils/lineinput.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100118 android/utils/mapfile.c \
119 android/utils/misc.c \
120 android/utils/panic.c \
121 android/utils/path.c \
122 android/utils/reflist.c \
123 android/utils/refset.c \
124 android/utils/stralloc.c \
125 android/utils/system.c \
126 android/utils/tempfile.c \
127 android/utils/vector.c \
128
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200129$(call gen-hw-config-defs)
130
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100131LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
132
133$(call end-emulator-library)
134
135##############################################################################
136##############################################################################
137###
138### emulator-libui: LIBRARY OF UI-RELATED FUNCTIONS
139###
140### THESE ARE USED BY 'emulator-ui' AND THE STANDALONE PROGRAMS
141###
142
143$(call start-emulator-library, emulator-libui)
144
145EMULATOR_LIBUI_CFLAGS :=
146
147LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
148
149###########################################################
150# Libpng configuration
151#
152LIBPNG_DIR := distrib/libpng-1.2.19
153include $(LOCAL_PATH)/$(LIBPNG_DIR)/sources.make
154
155EMULATOR_LIBUI_CFLAGS += \
156 $(LIBPNG_CFLAGS) \
157 -I$(LOCAL_PATH)/$(LIBPNG_DIR)
158
159LOCAL_SRC_FILES += $(LIBPNG_SOURCES) loadpng.c
160
161##############################################################################
162# SDL-related definitions
163#
164
165# Build SDL from sources except in certain cases where we use
166# prebuilt libraries instead.
167#
168BUILD_SDL_FROM_SOURCES := true
169
170# On linux-x86, using the prebuilts avoid installing all the X11
171# development packages on our build servers.
172#
173ifeq ($(QEMU_HOST_TAG),linux-x86)
174 BUILD_SDL_FROM_SOURCES := false
175endif
176
177# On darwin-x86, a bug in the Android build system prevents the compilation
178# of Objective-C sources. Fixed recently in AOSP, but we still use the
179# prebuilts for the benefit of older platform branches.
180#
181ifeq ($(QEMU_HOST_TAG),darwin-x86)
182 BUILD_SDL_FROM_SOURCES := false
183endif
184
185# If we're building with android-configure.sh && make, always build from
186# sources to catch regressions as soon as they happen.
187#
188ifeq ($(BUILD_STANDALONE_EMULATOR),true)
189 BUILD_SDL_FROM_SOURCES := true
190endif
191
192# Except if we used android-configure.sh --sdl-config=<script>
193#
194ifneq ($(SDL_CONFIG),)
195 BUILD_SDL_FROM_SOURCES := false
196endif
197
198ifneq ($(BUILD_SDL_FROM_SOURCES),true)
199
200 SDL_CONFIG ?= prebuilt/$(QEMU_HOST_TAG)/sdl/bin/sdl-config
201 SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
202
203 # We need to filter out the _GNU_SOURCE variable because it breaks recent
204 # releases of Cygwin when using the -mno-cygwin option. Moreover, we don't
205 # need this macro at all to build the Android emulator.
206 SDL_CFLAGS := $(filter-out -D_GNU_SOURCE=1,$(SDL_CFLAGS))
207 SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs))
208
209 # Circular dependencies between libSDL and libSDLmain
210 # We repeat the libraries in the final link to work around it
211 SDL_STATIC_LIBRARIES := libSDL libSDLmain libSDL libSDLmain
212
213else # BUILD_SDL_FROM_SOURCES
214
215 SDL_DIR := distrib/sdl-1.2.12
216 include $(LOCAL_PATH)/$(SDL_DIR)/sources.make
217 LOCAL_SRC_FILES += $(SDL_SOURCES)
218
219 EMULATOR_LIBUI_CFLAGS += \
220 -I$(LOCAL_PATH)/$(SDL_DIR)/include
221
222 SDL_STATIC_LIBRARIES :=
223
224endif # BUILD_SDL_FROM_SOURCES
225
226EMULATOR_LIBUI_CFLAGS += $(SDL_CFLAGS)
227EMULATOR_LIBUI_LDLIBS += $(SDL_LDLIBS)
228
229# The following is needed by SDL_LoadObject
230ifneq ($(HOST_OS),windows)
231 EMULATOR_LIBUI_LDLIBS += -ldl
232endif
233
234# the skin support sources
235#
236SKIN_SOURCES := rect.c \
237 region.c \
238 image.c \
239 trackball.c \
240 keyboard.c \
241 keyset.c \
242 file.c \
243 window.c \
244 scaler.c \
245 composer.c \
246 surface.c \
247
248LOCAL_SRC_FILES += $(SKIN_SOURCES:%=android/skin/%)
249
250LOCAL_SRC_FILES += \
251 android/user-config.c \
252 android/resource.c \
253 android/qemulator.c \
254 android/keycode.c \
255
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200256$(call gen-hw-config-defs)
257
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100258# enable MMX code for our skin scaler
259ifeq ($(HOST_ARCH),x86)
260LOCAL_CFLAGS += -DUSE_MMX=1 -mmmx
261endif
262
263LOCAL_CFLAGS += $(EMULATOR_LIBUI_CFLAGS)
264
265$(call end-emulator-library)
266
267##############################################################################
268##############################################################################
269###
270### emulator-libqemu: TARGET-INDEPENDENT QEMU FUNCTIONS
271###
272### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui'
273###
274
275$(call start-emulator-library, emulator-libqemu)
276
277EMULATOR_LIBQEMU_CFLAGS :=
278
279LOCAL_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
280
281AUDIO_SOURCES := noaudio.c wavaudio.c wavcapture.c mixeng.c
282AUDIO_CFLAGS := -I$(LOCAL_PATH)/audio -DHAS_AUDIO
283AUDIO_LDLIBS :=
284
285LOCAL_CFLAGS += -Wall -Wno-missing-field-initializers
286
287ifeq ($(HOST_OS),darwin)
288 CONFIG_COREAUDIO ?= yes
289 AUDIO_CFLAGS += -DHOST_BSD=1
290endif
291
292ifeq ($(HOST_OS),windows)
293 CONFIG_WINAUDIO ?= yes
294endif
295
296ifeq ($(HOST_OS),linux)
297 CONFIG_OSS ?= yes
298 CONFIG_ALSA ?= yes
299 CONFIG_PULSEAUDIO ?= yes
300 CONFIG_ESD ?= yes
301endif
302
303ifeq ($(HOST_OS),freebsd)
304 CONFIG_OSS ?= yes
305endif
306
307ifeq ($(CONFIG_COREAUDIO),yes)
308 AUDIO_SOURCES += coreaudio.c
309 AUDIO_CFLAGS += -DCONFIG_COREAUDIO
310 AUDIO_LDLIBS += -Wl,-framework,CoreAudio
311endif
312
313ifeq ($(CONFIG_WINAUDIO),yes)
314 AUDIO_SOURCES += winaudio.c
315 AUDIO_CFLAGS += -DCONFIG_WINAUDIO
316endif
317
318ifeq ($(CONFIG_PULSEAUDIO),yes)
319 AUDIO_SOURCES += paaudio.c audio_pt_int.c
320 AUDIO_CFLAGS += -DCONFIG_PULSEAUDIO
321endif
322
323ifeq ($(CONFIG_ALSA),yes)
324 AUDIO_SOURCES += alsaaudio.c audio_pt_int.c
325 AUDIO_CFLAGS += -DCONFIG_ALSA
326endif
327
328ifeq ($(CONFIG_ESD),yes)
329 AUDIO_SOURCES += esdaudio.c
330 AUDIO_CFLAGS += -DCONFIG_ESD
331endif
332
333ifeq ($(CONFIG_OSS),yes)
334 AUDIO_SOURCES += ossaudio.c
335 AUDIO_CFLAGS += -DCONFIG_OSS
336endif
337
338AUDIO_SOURCES := $(call sort,$(AUDIO_SOURCES:%=audio/%))
339
340LOCAL_CFLAGS += -Wno-sign-compare \
341 -fno-strict-aliasing -W -Wall -Wno-unused-parameter \
342
343# this is very important, otherwise the generated binaries may
344# not link properly on our build servers
345ifeq ($(HOST_OS),linux)
346LOCAL_CFLAGS += -fno-stack-protector
347endif
348
349LOCAL_SRC_FILES += $(AUDIO_SOURCES)
350LOCAL_SRC_FILES += \
351 android/audio-test.c
352
353# other flags
354ifneq ($(HOST_OS),windows)
355 AUDIO_LDLIBS += -ldl
356else
357endif
358
359
360EMULATOR_LIBQEMU_CFLAGS += $(AUDIO_CFLAGS)
361EMULATOR_LIBQEMU_LDLIBS += $(AUDIO_LDLIBS)
362
363LOCAL_CFLAGS += -Wno-missing-field-initializers
364
365# migration sources
366#
367ifeq ($(HOST_OS),windows)
368 LOCAL_SRC_FILES += migration-dummy-android.c
369else
370 LOCAL_SRC_FILES += migration.c \
371 migration-exec.c \
372 migration-tcp-android.c
373endif
374
375# misc. sources
376#
377CORE_MISC_SOURCES = \
378 acl.c \
379 aes.c \
380 aio-android.c \
381 async.c \
382 bt-host.c \
383 bt-vhci.c \
384 buffered_file.c \
385 cbuffer.c \
386 charpipe.c \
387 console.c \
388 cutils.c \
389 d3des.c \
390 input.c \
David 'Digit' Turner8354d2d2011-05-11 00:19:06 +0200391 iohandler.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100392 ioport.c \
393 module.c \
394 net-android.c \
395 notify.c \
396 osdep.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100397 path.c \
David 'Digit' Turner3b2846a2011-05-11 01:34:40 +0200398 qemu-char.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100399 qemu-config.c \
400 qemu-error.c \
401 qemu-malloc.c \
402 qemu-option.c \
403 qemu-sockets-android.c \
404 qerror.c \
405 readline.c \
406 savevm.c \
407 shaper.c \
408 tcpdump.c \
409 vnc-android.c \
410 android/boot-properties.c \
411 android/config.c \
412 android/core-init-utils.c \
413 android/gps.c \
414 android/hw-kmsg.c \
415 android/hw-lcd.c \
416 android/hw-events.c \
417 android/hw-control.c \
418 android/hw-sensors.c \
419 android/hw-qemud.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100420 android/looper-qemu.c \
David 'Digit' Turnerc0ac7332011-05-02 15:05:35 +0200421 android/hw-pipe-net.c \
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100422 android/qemu-setup.c \
423 android/snapshot.c \
424 android/utils/timezone.c \
425
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200426$(call gen-hw-config-defs)
427
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100428ifeq ($(HOST_ARCH),x86)
429 CORE_MISC_SOURCES += i386-dis.c
430endif
431ifeq ($(HOST_ARCH),x86_64)
432 CORE_MISC_SOURCES += i386-dis.c
433endif
434ifeq ($(HOST_ARCH),ppc)
435 CORE_MISC_SOURCES += ppc-dis.c \
436 cache-utils.c
437endif
438
439ifeq ($(HOST_OS),linux)
440 CORE_MISC_SOURCES += usb-linux.c \
441 qemu-thread.c
442else
443 CORE_MISC_SOURCES += usb-dummy-android.c
444endif
445
446ifeq ($(HOST_OS),windows)
447 CORE_MISC_SOURCES += tap-win32.c
448else
449 CORE_MISC_SOURCES += posix-aio-compat.c
450endif
451
452LOCAL_SRC_FILES += $(CORE_MISC_SOURCES)
453
454# Required
455LOCAL_CFLAGS += -D_XOPEN_SOURCE=600 -D_BSD_SOURCE=1
456
457SLIRP_SOURCES := \
458 bootp.c \
459 cksum.c \
460 debug.c \
461 if.c \
462 ip_icmp.c \
463 ip_input.c \
464 ip_output.c \
465 mbuf.c \
466 misc.c \
467 sbuf.c \
468 slirp.c \
469 socket.c \
470 tcp_input.c \
471 tcp_output.c \
472 tcp_subr.c \
473 tcp_timer.c \
474 tftp.c \
475 udp.c
476
477LOCAL_SRC_FILES += $(SLIRP_SOURCES:%=slirp-android/%)
478EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/slirp-android
479
480# socket proxy support
481#
482PROXY_SOURCES := \
483 proxy_common.c \
484 proxy_http.c \
485 proxy_http_connector.c \
486 proxy_http_rewriter.c \
487
488LOCAL_SRC_FILES += $(PROXY_SOURCES:%=proxy/%)
489EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/proxy
490
491# include telephony stuff
492#
493TELEPHONY_SOURCES := \
494 android_modem.c \
495 modem_driver.c \
496 gsm.c \
497 sim_card.c \
498 sysdeps_qemu.c \
499 sms.c \
500 remote_call.c
501
502LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
503EMULATOR_LIBQEMU_CFLAGS += -I$(LOCAL_PATH)/telephony
504
505# sources inherited from upstream, but not fully
506# integrated into android emulator
507#
508LOCAL_SRC_FILES += \
509 json-lexer.c \
510 json-parser.c \
511 json-streamer.c \
512 qjson.c \
513 qbool.c \
514 qdict.c \
515 qfloat.c \
516 qint.c \
517 qlist.c \
518 qstring.c \
519
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100520# gdbstub-xml.c contains C-compilable arrays corresponding to the content
521# of $(LOCAL_PATH)/gdb-xml/, and is generated with the 'feature_to_c.sh' script.
522#
523intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,$(LOCAL_MODULE),true)
524
525ifeq ($(QEMU_TARGET_XML_SOURCES),)
526 QEMU_TARGET_XML_SOURCES := arm-core arm-neon arm-vfp arm-vfp3
527 QEMU_TARGET_XML_SOURCES := $(QEMU_TARGET_XML_SOURCES:%=$(LOCAL_PATH)/gdb-xml/%.xml)
528endif
529
530QEMU_GDBSTUB_XML_C := $(intermediates)/gdbstub-xml.c
531$(QEMU_GDBSTUB_XML_C): PRIVATE_PATH := $(LOCAL_PATH)
532$(QEMU_GDBSTUB_XML_C): PRIVATE_SOURCES := $(TARGET_XML_SOURCES)
533$(QEMU_GDBSTUB_XML_C): PRIVATE_CUSTOM_TOOL = $(PRIVATE_PATH)/feature_to_c.sh $@ $(QEMU_TARGET_XML_SOURCES)
534$(QEMU_GDBSTUB_XML_C): $(QEMU_TARGET_XML_SOURCES) $(LOCAL_PATH)/feature_to_c.sh
535 $(hide) rm -f $@
536 $(transform-generated-source)
537
538LOCAL_GENERATED_SOURCES += $(QEMU_GDBSTUB_XML_C)
539
540EMULATOR_LIBQEMU_CFLAGS += -I$(intermediates)
541
542LOCAL_CFLAGS += $(EMULATOR_LIBQEMU_CFLAGS)
543
544$(call end-emulator-library)
545
546# Block sources, we must compile them with each executable because they
547# are only referenced by the rest of the code using constructor functions.
548# If their object files are put in a static library, these are never compiled
549# into the final linked executable that uses them.
550#
551# Normally, one would solve thus using LOCAL_WHOLE_STATIC_LIBRARIES, but
552# the Darwin linker doesn't support -Wl,--whole-archive or equivalent :-(
553#
554BLOCK_SOURCES += \
555 block.c \
556 blockdev.c \
557 block/qcow.c \
558 block/qcow2.c \
559 block/qcow2-refcount.c \
560 block/qcow2-snapshot.c \
561 block/qcow2-cluster.c \
562 block/cloop.c \
563 block/dmg.c \
564 block/vvfat.c \
565 block/raw.c
566
567ifeq ($(HOST_OS),windows)
568 BLOCK_SOURCES += block/raw-win32.c
569else
570 BLOCK_SOURCES += block/raw-posix.c
571endif
572
573BLOCK_CFLAGS += $(EMULATOR_COMMON_CFLAGS)
574BLOCK_CFLAGS += -DCONFIG_BDRV_WHITELIST=""
575
576
577##############################################################################
578##############################################################################
579###
580### emulator-libelff: TARGET-INDEPENDENT ELF/DWARD PARSER
581###
582### THESE ARE USED BY EVERYTHING EXCEPT 'emulator-ui', BUT WE CANNOT PUT
583### THEM IN emulator-libqemu SINCE THE SOURCES ARE C++
584###
585
586$(call start-emulator-library, emulator-libelff)
587
588LOCAL_CPP_EXTENSION := .cc
589
590ELFF_CFLAGS := -I$(LOCAL_PATH)/elff
591ELFF_LDLIBS := -lstdc++
592
593ELFF_SOURCES := \
594 dwarf_cu.cc \
595 dwarf_die.cc \
596 dwarf_utils.cc \
597 elf_alloc.cc \
598 elf_file.cc \
599 elf_mapped_section.cc \
600 elff_api.cc \
601
602LOCAL_SRC_FILES += $(ELFF_SOURCES:%=elff/%)
603
604LOCAL_CFLAGS += \
605 -fno-exceptions \
606 $(ELFF_CFLAGS) \
607
608$(call end-emulator-library)
609
610
611##############################################################################
612##############################################################################
613###
614### gen-hx-header: Generate headers from .hx file with "hxtool" script.
615###
616### The 'hxtool' script is used to generate header files from an input
617### file with the .hx suffix. I.e. foo.hx --> foo.h
618###
619### Due to the way the Android build system works, we need to regenerate
620### it for each module (the output will go into a module-specific directory).
621###
622### This defines a function that can be used inside a module definition
623###
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200624### $(call gen-hx-header,<input>,<output>,<source-files>)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100625###
626### Where: <input> is the input file, with a .hx suffix (e.g. foo.hx)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200627### <output> is the output file, with a .h or .def suffix
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100628### <source-files> is a list of source files that include the header
629###
630
631
632gen-hx-header = $(eval $(call gen-hx-header-ev,$1,$2,$3))
633
634define gen-hx-header-ev
David 'Digit' Turner42fc4492011-06-29 13:16:16 +0200635intermediates := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),true)
David 'Digit' Turner317c9d52011-05-10 06:38:21 +0200636
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200637QEMU_HEADER_H := $$(intermediates)/$$2
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100638$$(QEMU_HEADER_H): PRIVATE_PATH := $$(LOCAL_PATH)
639$$(QEMU_HEADER_H): PRIVATE_CUSTOM_TOOL = $$(PRIVATE_PATH)/hxtool -h < $$< > $$@
640$$(QEMU_HEADER_H): $$(LOCAL_PATH)/$$1 $$(LOCAL_PATH)/hxtool
641 $$(transform-generated-source)
642
643LOCAL_GENERATED_SOURCES += $$(QEMU_HEADER_H)
David 'Digit' Turner088edf82011-05-09 15:59:28 +0200644LOCAL_C_INCLUDES += $$(intermediates)
David 'Digit' Turneraff94b82011-02-07 18:10:54 +0100645endef
646