1# Copyright © 2020 Google, Inc 2# SPDX-License-Identifier: MIT 3 4if with_tests 5 diff = find_program('diff') 6endif 7 8afuc_parser = custom_target( 9 'parser.[ch]', 10 input: 'parser.y', 11 output: ['parser.c', 'parser.h'], 12 command: [ 13 prog_bison, '@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@' 14 ] 15) 16 17afuc_lexer = custom_target( 18 'lexer.c', 19 input: 'lexer.l', 20 output: 'lexer.c', 21 command: [ 22 prog_flex, '-o', '@OUTPUT@', '@INPUT@' 23 ] 24) 25 26encode_h = custom_target( 27 'encode.h', 28 input: ['afuc.xml'], 29 output: 'encode.h', 30 command: [ 31 prog_isaspec_encode, '--xml', '@INPUT@', '--out-h', '@OUTPUT@' 32 ], 33) 34 35asm = executable( 36 'afuc-asm', 37 [ 38 'asm.c', 39 'util.c', 40 'util.h', 41 afuc_lexer, 42 afuc_parser, 43 encode_h, 44 ], 45 include_directories: [ 46 inc_freedreno_rnn, inc_include, inc_src, inc_util, 47 ], 48 link_with: [ 49 libfreedreno_rnn, 50 ], 51 dependencies: [], 52 build_by_default : with_tools.contains('freedreno'), 53 install: install_fd_decode_tools, 54) 55if with_tests 56 asm_fw = custom_target('afuc_test.fw', 57 output: 'afuc_test.fw', 58 command: [asm, files('../.gitlab-ci/traces/afuc_test.asm'), '@OUTPUT@'], 59 ) 60 asm_fw_a7xx = custom_target('afuc_test_a7xx.fw', 61 output: 'afuc_test_a7xx.fw', 62 command: [asm, files('../.gitlab-ci/traces/afuc_test_a7xx.asm'), '@OUTPUT@'], 63 ) 64 test('afuc-asm', 65 diff, 66 args: ['-u', files('../.gitlab-ci/reference/afuc_test.fw'), asm_fw], 67 suite: 'freedreno', 68 workdir: dir_source_root 69 ) 70 test('afuc-asm-a7xx', 71 diff, 72 args: ['-u', files('../.gitlab-ci/reference/afuc_test_a7xx.fw'), asm_fw_a7xx], 73 suite: 'freedreno', 74 workdir: dir_source_root 75 ) 76endif 77 78afuc_isa = custom_target( 79 'afuc-isa', 80 input: ['afuc.xml'], 81 output: ['afuc-isa.c', 'afuc-isa.h'], 82 command: [ 83 prog_isaspec_decode, '--xml', '@INPUT@', 84 '--out-c', '@OUTPUT0@', '--out-h', '@OUTPUT1@', 85 ], 86) 87 88# Disasm requires mmaping >4GB 89if cc.sizeof('size_t') > 4 90 disasm = executable( 91 'afuc-disasm', 92 [ 93 'disasm.c', 94 'emu.c', 95 'emu.h', 96 'emu-ds.c', 97 'emu-regs.c', 98 'emu-ui.c', 99 'util.c', 100 'util.h', 101 afuc_isa, 102 ], 103 include_directories: [ 104 inc_freedreno, 105 inc_freedreno_rnn, 106 inc_include, 107 inc_src, 108 inc_util, 109 ], 110 link_with: [ 111 libfreedreno_rnn, 112 libisaspec 113 ], 114 dependencies: [idep_mesautil, idep_isaspec_decode], 115 build_by_default : with_tools.contains('freedreno'), 116 install: install_fd_decode_tools, 117 ) 118 119 if with_tests 120 disasm_fw = custom_target('afuc_test.asm', 121 output: 'afuc_test.asm', 122 command: [disasm, '-u', files('../.gitlab-ci/reference/afuc_test.fw')], 123 capture: true 124 ) 125 disasm_fw_a7xx = custom_target('afuc_test_a7xx.asm', 126 output: 'afuc_test_a7xx.asm', 127 command: [disasm, '-u', files('../.gitlab-ci/reference/afuc_test_a7xx.fw')], 128 capture: true 129 ) 130 test('afuc-disasm', 131 diff, 132 args: ['-u', files('../.gitlab-ci/reference/afuc_test.asm'), disasm_fw], 133 suite: 'freedreno', 134 workdir: dir_source_root 135 ) 136 test('afuc-disasm-a7xx', 137 diff, 138 args: ['-u', files('../.gitlab-ci/reference/afuc_test_a7xx.asm'), disasm_fw_a7xx], 139 suite: 'freedreno', 140 workdir: dir_source_root 141 ) 142 endif 143endif 144