1# Copyright © 2018 Valve Corporation
2# Copyright © 2019 Mauro Rossi issor.oruam@gmail.com
3
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the "Software"),
6# to deal in the Software without restriction, including without limitation
7# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8# and/or sell copies of the Software, and to permit persons to whom the
9# Software is furnished to do so, subject to the following conditions:
10#
11# The above copyright notice and this permission notice (including the next
12# paragraph) shall be included in all copies or substantial portions of the
13# Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21# IN THE SOFTWARE.
22
23LOCAL_PATH := $(call my-dir)
24
25include $(LOCAL_PATH)/Makefile.sources
26
27# ---------------------------------------
28# Build libmesa_aco
29# ---------------------------------------
30
31include $(CLEAR_VARS)
32
33LOCAL_MODULE := libmesa_aco
34LOCAL_LICENSE_KINDS := SPDX-license-identifier-ISC SPDX-license-identifier-MIT
35LOCAL_LICENSE_CONDITIONS := notice
36LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../LICENSE
37
38LOCAL_SRC_FILES := \
39	$(ACO_FILES)
40
41LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU   # instructs LLVM to declare LLVMInitializeAMDGPU* functions
42
43LOCAL_CPPFLAGS += -Wall -std=c++14
44
45# generate sources
46LOCAL_MODULE_CLASS := STATIC_LIBRARIES
47intermediates := $(call local-generated-sources-dir)
48LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, $(ACO_GENERATED_FILES))
49
50ACO_OPCODES_H_SCRIPT := $(MESA_TOP)/src/amd/compiler/aco_opcodes_h.py
51ACO_OPCODES_CPP_SCRIPT := $(MESA_TOP)/src/amd/compiler/aco_opcodes_cpp.py
52ACO_BUILDER_H_SCRIPT := $(MESA_TOP)/src/amd/compiler/aco_builder_h.py
53
54ACO_DEPS := $(MESA_TOP)/src/amd/compiler/aco_opcodes.py
55
56$(intermediates)/compiler/aco_opcodes.h: $(ACO_OPCODES_H_SCRIPT) $(ACO_DEPS)
57	@mkdir -p $(dir $@)
58	@echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
59	$(hide) $(MESA_PYTHON2) $(ACO_OPCODES_H_SCRIPT) > $@ || ($(RM) $@; false)
60
61$(intermediates)/compiler/aco_opcodes.cpp: $(ACO_OPCODES_CPP_SCRIPT) $(ACO_DEPS)
62	@mkdir -p $(dir $@)
63	@echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
64	$(hide) $(MESA_PYTHON2) $(ACO_OPCODES_CPP_SCRIPT) > $@ || ($(RM) $@; false)
65
66$(intermediates)/compiler/aco_builder.h: $(ACO_BUILDER_H_SCRIPT) $(ACO_DEPS)
67	@mkdir -p $(dir $@)
68	@echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
69	$(hide) $(MESA_PYTHON2) $(ACO_BUILDER_H_SCRIPT) > $@ || ($(RM) $@; false)
70
71LOCAL_C_INCLUDES := \
72	$(MESA_TOP)/src/amd \
73	$(MESA_TOP)/src/amd/common \
74	$(MESA_TOP)/src/amd/compiler \
75	$(MESA_TOP)/src/compiler/nir \
76	$(MESA_TOP)/src/gallium/include \
77	$(MESA_TOP)/src/mapi \
78	$(MESA_TOP)/src/mesa \
79	$(intermediates)/compiler
80
81LOCAL_EXPORT_C_INCLUDE_DIRS := \
82	$(MESA_TOP)/src/amd/compiler \
83	$(intermediates)/compiler
84
85LOCAL_SHARED_LIBRARIES := \
86	libdrm_amdgpu
87
88LOCAL_STATIC_LIBRARIES := \
89	libmesa_amd_common \
90	libmesa_nir
91
92$(call mesa-build-with-llvm)
93
94include $(MESA_COMMON_MK)
95include $(BUILD_STATIC_LIBRARY)
96