Commit 1a3f340d authored by Thiago Macieira's avatar Thiago Macieira
Browse files

Update/fix the qmake support for (f)lex


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: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
Showing with 15 additions and 6 deletions
......@@ -10,13 +10,22 @@
} else {
lex.variable_out = GENERATED_SOURCES
}
isEmpty(QMAKE_LEXFLAGS_MANGLE):QMAKE_LEXFLAGS_MANGLE = -P${QMAKE_FILE_BASE}
QMAKE_LEXEXTRAFLAGS = $$QMAKE_LEXFLAGS
!yacc_no_name_mangle:QMAKE_LEXEXTRAFLAGS += $$QMAKE_LEXFLAGS_MANGLE
lex.commands = $$QMAKE_LEX $$QMAKE_LEXEXTRAFLAGS ${QMAKE_FILE_IN}$$escape_expand(\\n\\t) \
$$QMAKE_DEL_FILE $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)}$$escape_expand(\\n\\t) \
$$QMAKE_MOVE lex.${QMAKE_FILE_BASE}.c $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)}$$escape_expand(\\n\\t)
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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment