aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/meson.build
blob: 78c6b9b0a232a0f08301a37c433144242bb330c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright (c) 2022-2025, PostgreSQL Global Development Group

wait_event_output = ['wait_event_types.h', 'pgstat_wait_event.c', 'wait_event_funcs_data.c']
wait_event_target = custom_target('wait_event_names',
  input: files('../../backend/utils/activity/wait_event_names.txt'),
  output: wait_event_output,
  command: [
    perl, files('../../backend/utils/activity/generate-wait_event_types.pl'),
    '--outdir', '@OUTDIR@', '--code',
    '@INPUT@'
  ],
  build_by_default: true,
  install: true,
  install_dir: [dir_include_server / 'utils', false, false],
)

wait_event_types_h = wait_event_target[0]
generated_backend_headers += wait_event_types_h

errcodes = custom_target('errcodes',
  input: files('../../backend/utils/errcodes.txt'),
  output: ['errcodes.h'],
  command: [
    perl, files('../../backend/utils/generate-errcodes.pl'),
    '--outfile', '@OUTPUT@',
    '@INPUT@',
  ],
  install: true,
  install_dir: dir_include_server / 'utils',
)
generated_headers += errcodes

if dtrace.found()
  probes_tmp = custom_target('probes.h.tmp',
    input: files('../../backend/utils/probes.d'),
    output: 'probes.h.tmp',
    command: [dtrace, '-C', '-h', '-s', '@INPUT@', '-o', '@OUTPUT@'],
  )
  probes = custom_target('probes.h',
    input: probes_tmp,
    output: 'probes.h',
    capture: true,
    command: [sed, '-f', files('../../backend/utils/postprocess_dtrace.sed'), '@INPUT@'],
    install: true,
    install_dir: dir_include_server / 'utils',
  )
else
  probes = custom_target('probes.h',
    input: files('../../backend/utils/probes.d'),
    output: 'probes.h',
    capture: true,
    command: [perl, '-n', files('../../backend/utils/Gen_dummy_probes.pl'), '@INPUT@'],
    install: true,
    install_dir: dir_include_server / 'utils',
  )
endif

generated_backend_headers += probes

fmgrtab_output = ['fmgroids.h', 'fmgrprotos.h', 'fmgrtab.c']
fmgrtab_target = custom_target('fmgrtab',
  input: '../catalog/pg_proc.dat',
  output : fmgrtab_output,
  depend_files: catalog_pm,
  command: [perl, '-I', '@SOURCE_ROOT@/src/backend/catalog/', files('../../backend/utils/Gen_fmgrtab.pl'), '--include-path=@SOURCE_ROOT@/src/include', '--output=@OUTDIR@', '@INPUT@'],
  install: true,
  install_dir: [dir_include_server / 'utils', dir_include_server / 'utils', false],
)

generated_backend_headers += fmgrtab_target[0]
generated_backend_headers += fmgrtab_target[1]

# autoconf generates the file there, ensure we get a conflict
generated_sources_ac += {
  'src/backend/utils': fmgrtab_output + ['errcodes.h', 'probes.h', 'fmgr-stamp'],
  'src/include/utils': ['header-stamp'],
}

generated_sources_ac += {'src/backend/utils/activity': ['wait_event_types.h']}