blob: 167ed0adc7ef48fbf91be8afa3fcc8ea58a06ebc [file] [log] [blame]
Chia-I Wuee40f182011-08-17 11:31:36 +08001# Mesa 3-D graphics library
2#
3# Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
4# Copyright (C) 2010-2011 LunarG Inc.
5#
6# Permission is hereby granted, free of charge, to any person obtaining a
7# copy of this software and associated documentation files (the "Software"),
8# to deal in the Software without restriction, including without limitation
9# the rights to use, copy, modify, merge, publish, distribute, sublicense,
10# and/or sell copies of the Software, and to permit persons to whom the
11# Software is furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included
14# in all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22# DEALINGS IN THE SOFTWARE.
23
24# included by core mesa Android.mk for source generation
25
26ifeq ($(LOCAL_MODULE_CLASS),)
27LOCAL_MODULE_CLASS := STATIC_LIBRARIES
28endif
29
Chih-Wei Huangb0e33c22015-04-04 05:01:22 +080030intermediates := $(call local-generated-sources-dir)
Casey Dahlincbdafed2017-04-26 10:39:46 -070031prebuilt_intermediates := $(MESA_TOP)/prebuilt-intermediates
Chia-I Wuee40f182011-08-17 11:31:36 +080032
Daniel Charles948c8f52012-07-26 14:18:15 -070033# This is the list of auto-generated files: sources and headers
Chia-I Wuee40f182011-08-17 11:31:36 +080034sources := \
Daniel Charles948c8f52012-07-26 14:18:15 -070035 main/enums.c \
Tapani Pälli0fda2e92012-11-29 09:48:00 +020036 main/api_exec.c \
Daniel Charles948c8f52012-07-26 14:18:15 -070037 main/dispatch.h \
Mauro Rossi5f7081e2015-03-27 18:20:53 +000038 main/format_pack.c \
39 main/format_unpack.c \
40 main/format_info.h \
Imre Deak98f880e2012-09-10 08:46:13 +030041 main/remap_helper.h \
42 main/get_hash.h
Chia-I Wuee40f182011-08-17 11:31:36 +080043
44LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
45
46LOCAL_C_INCLUDES += $(intermediates)/main
47
48ifeq ($(strip $(MESA_ENABLE_ASM)),true)
49ifeq ($(TARGET_ARCH),x86)
50sources += x86/matypes.h
51LOCAL_C_INCLUDES += $(intermediates)/x86
52endif
53endif
54
55sources += main/git_sha1.h
56
57sources := $(addprefix $(intermediates)/, $(sources))
Tapani Pällid5c18012012-06-07 14:11:31 +030058
Chia-I Wuee40f182011-08-17 11:31:36 +080059LOCAL_GENERATED_SOURCES += $(sources)
60
61glapi := $(MESA_TOP)/src/mapi/glapi/gen
62
Paul Berrya8ab7e32012-10-23 13:24:17 -070063dispatch_deps := \
Chia-I Wuee40f182011-08-17 11:31:36 +080064 $(wildcard $(glapi)/*.py) \
65 $(wildcard $(glapi)/*.xml)
66
67define es-gen
68 @mkdir -p $(dir $@)
69 @echo "Gen ES: $(PRIVATE_MODULE) <= $(notdir $(@))"
70 $(hide) $(PRIVATE_SCRIPT) $(1) $(PRIVATE_XML) > $@
71endef
72
Chia-I Wuee40f182011-08-17 11:31:36 +080073$(intermediates)/main/git_sha1.h:
74 @mkdir -p $(dir $@)
75 @echo "GIT-SHA1: $(PRIVATE_MODULE) <= git"
76 $(hide) touch $@
77 $(hide) if which git > /dev/null; then \
78 git --git-dir $(PRIVATE_PATH)/../../.git log -n 1 --oneline | \
79 sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
80 > $@; \
81 fi
82
83matypes_deps := \
84 $(BUILD_OUT_EXECUTABLES)/mesa_gen_matypes$(BUILD_EXECUTABLE_SUFFIX) \
85 $(LOCAL_PATH)/main/mtypes.h \
86 $(LOCAL_PATH)/tnl/t_context.h
87
88$(intermediates)/x86/matypes.h: $(matypes_deps)
89 @mkdir -p $(dir $@)
90 @echo "MATYPES: $(PRIVATE_MODULE) <= $(notdir $@)"
91 $(hide) $< > $@
Daniel Charles948c8f52012-07-26 14:18:15 -070092
Casey Dahlincbdafed2017-04-26 10:39:46 -070093$(intermediates)/main/dispatch.h: $(prebuilt_intermediates)/main/dispatch.h
94 cp -a $< $@
Daniel Charles948c8f52012-07-26 14:18:15 -070095
Casey Dahlincbdafed2017-04-26 10:39:46 -070096$(intermediates)/main/remap_helper.h: $(prebuilt_intermediates)/main/remap_helper.h
97 cp -a $< $@
Daniel Charles948c8f52012-07-26 14:18:15 -070098
Casey Dahlincbdafed2017-04-26 10:39:46 -070099$(intermediates)/main/enums.c: $(prebuilt_intermediates)/main/enums.c
100 cp -a $< $@
Daniel Charles948c8f52012-07-26 14:18:15 -0700101
Casey Dahlincbdafed2017-04-26 10:39:46 -0700102$(intermediates)/main/api_exec.c: $(prebuilt_intermediates)/main/api_exec.c
103 cp -a $< $@
Daniel Charles948c8f52012-07-26 14:18:15 -0700104
Casey Dahlincbdafed2017-04-26 10:39:46 -0700105$(intermediates)/main/get_hash.h: $(prebuilt_intermediates)/main/get_hash.h
106 cp -a $< $@
Daniel Charles948c8f52012-07-26 14:18:15 -0700107
Casey Dahlincbdafed2017-04-26 10:39:46 -0700108$(intermediates)/main/format_info.h: $(prebuilt_intermediates)/main/format_info.h
109 cp -a $< $@
Imre Deak98f880e2012-09-10 08:46:13 +0300110
Casey Dahlincbdafed2017-04-26 10:39:46 -0700111$(intermediates)/main/format_pack.c: $(prebuilt_intermediates)/main/format_pack.c
112 cp -a $< $@
Paul Berry98874ec2012-10-31 10:42:08 -0700113
Casey Dahlincbdafed2017-04-26 10:39:46 -0700114$(intermediates)/main/format_unpack.c: $(prebuilt_intermediates)/main/format_unpack.c
115 cp -a $< $@