aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/meson.build
blob: aa948efc0dce88c0459f51d29954326d6b8a2840 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright (c) 2022-2025, PostgreSQL Global Development Group

ecpg_sources = files(
  '../ecpglib/typename.c',
  'c_keywords.c',
  'descriptor.c',
  'ecpg.c',
  'ecpg_keywords.c',
  'keywords.c',
  'output.c',
  'parser.c',
  'type.c',
  'util.c',
  'variable.c',
)

pgc = custom_target('pgc.c',
  input: 'pgc.l',
  output: 'pgc.c',
  command: flex_cmd,
)
generated_sources += pgc
ecpg_sources += pgc

ecpg_files = [
  'ecpg.addons',
  'ecpg.header',
  'ecpg.tokens',
  'ecpg.trailer',
  'ecpg.type',
]

preproc_y = custom_target('preproc.y',
  input: [
    '../../../backend/parser/gram.y',
    ecpg_files,
  ],
  output: ['preproc.y'],
  command: [
    perl, files('parse.pl'),
    '--srcdir', '@CURRENT_SOURCE_DIR@',
    '--parser', '@INPUT0@',
    '--output', '@OUTPUT0@',
  ],
)
generated_sources += preproc_y

preproc = custom_target('preproc.c',
  input: preproc_y,
  kwargs: bison_kw,
)
generated_sources += preproc.to_list()
ecpg_sources += preproc

c_kwlist = custom_target('c_kwlist_d.h',
  input: ['c_kwlist.h'],
  output: ['c_kwlist_d.h'],
  depend_files: gen_kwlist_deps,
  command: [gen_kwlist_cmd, '--varname', 'ScanCKeywords', '--no-case-fold'],
)
generated_sources += c_kwlist
ecpg_sources += c_kwlist

ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
  input: ['ecpg_kwlist.h'],
  output: ['ecpg_kwlist_d.h'],
  depend_files: gen_kwlist_deps,
  command: [gen_kwlist_cmd, '--varname', 'ScanECPGKeywords'],
)
generated_sources += ecpg_kwlist
ecpg_sources += ecpg_kwlist

if host_system == 'windows'
  ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
    '--NAME', 'ecpg',
    '--FILEDESC', 'ecpg - embedded SQL precompiler for C',])
endif

ecpg_exe = executable('ecpg',
  ecpg_sources,
  include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
  c_pch: pch_postgres_fe_h,
  dependencies: [frontend_code],
  kwargs: default_bin_args,
)
ecpg_targets += ecpg_exe

subdir('po', if_found: libintl)

tests += {
  'name': 'ecpg',
  'sd': meson.current_source_dir(),
  'bd': meson.current_build_dir(),
  'tap': {
    'tests': [
      't/001_ecpg_err_warn_msg.pl',
      't/002_ecpg_err_warn_msg_informix.pl',
    ],
    'deps': [ecpg_exe],
  },
}