1a3f340d0e
lex.prf was trying to be halfway between the standard POSIX lex requirements and those of GNU flex. So fix it to work with both, more or less, by noticing when lex is actually flex and using the extended GNU options. Note that POSIX lex is untested and may still not work. Change-Id: Ib306f8f647014b399b87ffff13f1e8e43fb68b3c Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
#
|
|
# Lex extra-compiler for handling files specified in the LEXSOURCES variable
|
|
#
|
|
|
|
{
|
|
lex.name = Lex ${QMAKE_FILE_IN}
|
|
lex.input = LEXSOURCES
|
|
lex_included {
|
|
lex.CONFIG += no_link
|
|
} else {
|
|
lex.variable_out = GENERATED_SOURCES
|
|
}
|
|
|
|
contains(QMAKE_LEX, .*flex) {
|
|
# GNU flex, we can use -o outfile
|
|
lex.commands = $$QMAKE_LEX $$QMAKE_LEXFLAGS --nounistd -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
|
|
} else {
|
|
# stupid POSIX lex, it only generates a file called lex.yy.c
|
|
# or lex.prefix.c if the -P<prefix> option is active
|
|
intermediate_file = lex.yy.c
|
|
QMAKE_LEXEXTRAFLAGS = $$QMAKE_LEXFLAGS $$QMAKE_LEXFLAGS_MANGLE
|
|
|
|
lex.commands = \
|
|
-$(DEL_FILE) ${QMAKE_FILE_OUT}$$escape_expand(\\n\\t) \
|
|
$$QMAKE_LEX $$QMAKE_LEXEXTRAFLAGS ${QMAKE_FILE_IN}$$escape_expand(\\n\\t) \
|
|
$(MOVE) $$intermediate_file ${QMAKE_FILE_OUT} $$escape_expand(\\n\\t)
|
|
unset(intermediate_file)
|
|
}
|
|
lex.output = $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)}
|
|
|
|
silent:lex.commands = @echo Lex ${QMAKE_FILE_IN} && $$lex.commands
|
|
QMAKE_EXTRA_COMPILERS += lex
|
|
}
|