android: freedreno/ir3: add missing generated sources and rules
authorMauro Rossi <issor.oruam@gmail.com>
Sat, 20 Jun 2020 17:07:44 +0000 (19:07 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 24 Jun 2020 10:00:14 +0000 (10:00 +0000)
Changelog:
- Makefile.sources: add ir3_lexer.c and ir3_parser.{c,h} generated sources
- Android.ir3.mk: add the necessary generated sources rules
- Android.ir3.mk: add the necessary include paths
- src/gallium/drivers/freedreno/Android.gen.mk: generate only ir3_nir_{imul,trig}.c for the moment

Fixes the following building error:

target  C: libfreedreno_ir3 <= external/mesa/src/freedreno/ir3/ir3_assembler.c
FAILED: out/target/product/x86_64/obj/STATIC_LIBRARIES/libfreedreno_ir3_intermediates/ir3/ir3_assembler.o
...
external/mesa/src/freedreno/ir3/ir3_assembler.c:28:10: fatal error: 'ir3_parser.h' file not found
         ^~~~~~~~~~~~~~
1 error generated.

Fixes: 1e8808a4a0f ("freedreno/ir3: refactor out helper to compile shader from asm")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5580>

src/freedreno/Android.ir3.mk
src/freedreno/Makefile.sources
src/gallium/drivers/freedreno/Android.gen.mk

index c6a9d3288d71c82e468f5033cc7879145b935002..ad3625a85bbcda308421ccdc4058064f54079f58 100644 (file)
@@ -31,21 +31,51 @@ include $(CLEAR_VARS)
 LOCAL_SRC_FILES := \
        $(ir3_SOURCES)
 
+LOCAL_MODULE := libfreedreno_ir3
+
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+intermediates := $(call local-generated-sources-dir)
+
 LOCAL_C_INCLUDES := \
        $(MESA_TOP)/src/compiler/nir \
        $(MESA_TOP)/src/gallium/include \
        $(MESA_TOP)/src/gallium/auxiliary \
        $(MESA_TOP)/prebuilt-intermediates/nir \
+       $(MESA_TOP)/src/freedreno/ir3 \
+       $(intermediates)/ir3
 
 # We need libmesa_nir to get NIR's generated include directories.
 LOCAL_STATIC_LIBRARIES := \
        libmesa_nir
 
-LOCAL_MODULE := libfreedreno_ir3
-
 LOCAL_GENERATED_SOURCES := \
        $(MESA_GEN_GLSL_H) \
        $(MESA_GEN_NIR_H)
 
+LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
+       ir3/ir3_lexer.c ir3/ir3_parser.c ir3/ir3_parser.h)
+
+ir3_lexer_deps := \
+       $(MESA_TOP)/src/freedreno/ir3/ir3_lexer.l
+
+ir3_parser_deps := \
+       $(MESA_TOP)/src/freedreno/ir3/ir3_parser.y
+
+$(intermediates)/ir3/ir3_lexer.c: $(ir3_lexer_deps)
+       @mkdir -p $(dir $@)
+       @echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
+       $(hide) flex -o $@ $<
+
+$(intermediates)/ir3/ir3_parser.c: $(ir3_parser_deps)
+       @mkdir -p $(dir $@)
+       @echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
+       $(hide) bison $< --name-prefix=ir3_yy --output=$@
+
+$(intermediates)/ir3/ir3_parser.h: $(ir3_parser_deps)
+       @mkdir -p $(dir $@)
+       @echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))"
+       $(hide) bison $< --name-prefix=ir3_yy --defines=$@
+
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
index 1e6d114a9695f697171ca10cdda8b027a4c1da88..908c7bdcb847fd4dfeb0e6be8de5f6c5ccd72783 100644 (file)
@@ -61,8 +61,11 @@ ir3_SOURCES := \
        ir3/ir3_validate.c
 
 ir3_GENERATED_FILES := \
+       ir3/ir3_lexer.c \
        ir3/ir3_nir_trig.c \
-       ir3/ir3_nir_imul.c
+       ir3/ir3_nir_imul.c \
+       ir3/ir3_parser.c \
+       ir3/ir3_parser.h
 
 perfcntrs_SOURCES := \
        perfcntrs/fd2_perfcntr.c \
index 21ee52b7e33ec8926301e1718607a7d53f9efc3e..b55e8d28a739e644c91cd74fb6e3acd32e6be566 100644 (file)
@@ -43,4 +43,4 @@ $(intermediates)/ir3/ir3_nir_imul.c: $(ir3_nir_imul_deps)
        $(hide) $(MESA_PYTHON2) $< -p $(MESA_TOP)/src/compiler/nir > $@
 
 LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
-       $(ir3_GENERATED_FILES))
+       ir3/ir3_nir_trig.c ir3/ir3_nir_imul.c)