qt5base-lts/mkspecs/features/qlalr.prf
Joerg Bornemann 1f30bcf336 Move build tools to libexec instead of the bin dir
[ChangeLog][Build System] Tools that are called by the build system and
are unlikely to be called by the user are now installed to the libexec
directory.

This is a step towards easier co-installability of different Qt
versions.

Pick-to: 6.1
Task-number: QTBUG-88791
Change-Id: Id19575b5ba27795f7715e4ea6a09391b26dd4942
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-02-23 17:02:30 +01:00

51 lines
2.0 KiB
Plaintext

qtPrepareLibExecTool(QMAKE_QLALR, qlalr)
isEmpty(QLALR_DIR): QLALR_DIR = .
!isEmpty(QLALRSOURCES) {
INCLUDEPATH += $$absolute_path($$QLALR_DIR, $$OUT_PWD)
}
for (s, QLALRSOURCES) {
sf = $$absolute_path($$s, $$_PRO_FILE_PWD_)
QMAKE_INTERNAL_INCLUDED_FILES += $$sf
sfl = $$cat($$sf, lines)
parser = $$lower($$member($$list($$find(sfl, "^%parser\\s")), 1))
isEmpty(parser): error("Could not extract %parser from $$sf")
decl = $$member($$list($$find(sfl, "^%decl\\s")), 1)
isEmpty(decl): error("Could not extract %decl from $$sf")
impl = $$member($$list($$find(sfl, "^%impl\\s")), 1)
isEmpty(impl): error("Could not extract %impl from $$sf")
base = qlalr_$$replace(sf, ^.*/([^./]+)[^/]*$, \\1)
invar = $$upper($$base)_SOURCES
$$invar = $$sf
$${base}.input = $$invar
$${base}.output = $$QLALR_DIR/$${parser}.cpp
$${base}.variable_out = GENERATED_SOURCES
$${base}.depends += $$QMAKE_QLALR_EXE
$${base}.commands = $$QMAKE_QLALR $$QMAKE_QLALRFLAGS ${QMAKE_FILE_IN}
silent: $${base}.commands = @echo qlalr ${QMAKE_FILE_IN} && $$eval($${base}.commands)
$${base}.name = QLALR ${QMAKE_FILE_IN}
$${base}_h.input = $$invar
$${base}_h.output = $$QLALR_DIR/$${parser}_p.h
$${base}_h.CONFIG = no_link
$${base}_h.depends += $$QLALR_DIR/$${parser}.cpp
$${base}_h.commands = $$escape_expand(\\n) # force creation of rule
$${base}_decl.input = $$invar
$${base}_decl.output = $$QLALR_DIR/$${decl}
$${base}_decl.CONFIG = no_link
$${base}_decl.depends += $$QLALR_DIR/$${parser}.cpp
$${base}_decl.commands = $$escape_expand(\\n) # force creation of rule
$${base}_impl.input = $$invar
$${base}_impl.output = $$QLALR_DIR/$${impl}
$${base}_impl.variable_out = GENERATED_SOURCES
$${base}_impl.depends += $$QLALR_DIR/$${parser}.cpp
$${base}_impl.commands = $$escape_expand(\\n) # force creation of rule
QMAKE_EXTRA_COMPILERS += $$base $${base}_h $${base}_decl $${base}_impl
}