qlalr.prf 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. qtPrepareTool(QMAKE_QLALR, qlalr)
  2. isEmpty(QLALR_DIR): QLALR_DIR = .
  3. !isEmpty(QLALRSOURCES) {
  4. INCLUDEPATH += $$absolute_path($$QLALR_DIR, $$OUT_PWD)
  5. }
  6. for (s, QLALRSOURCES) {
  7. sf = $$absolute_path($$s, $$_PRO_FILE_PWD_)
  8. QMAKE_INTERNAL_INCLUDED_FILES += $$sf
  9. sfl = $$cat($$sf, lines)
  10. parser = $$lower($$member($$list($$find(sfl, "^%parser\\s")), 1))
  11. isEmpty(parser): error("Could not extract %parser from $$sf")
  12. decl = $$member($$list($$find(sfl, "^%decl\\s")), 1)
  13. isEmpty(decl): error("Could not extract %decl from $$sf")
  14. impl = $$member($$list($$find(sfl, "^%impl\\s")), 1)
  15. isEmpty(impl): error("Could not extract %impl from $$sf")
  16. base = qlalr_$$replace(sf, ^.*/([^./]+)[^/]*$, \\1)
  17. invar = $$upper($$base)_SOURCES
  18. $$invar = $$sf
  19. $${base}.input = $$invar
  20. $${base}.output = $$QLALR_DIR/$${parser}.cpp
  21. $${base}.variable_out = GENERATED_SOURCES
  22. $${base}.depends += $$QMAKE_QLALR_EXE
  23. $${base}.commands = $$QMAKE_QLALR $$QMAKE_QLALRFLAGS ${QMAKE_FILE_IN}
  24. silent: $${base}.commands = @echo qlalr ${QMAKE_FILE_IN} && $${base}.commands
  25. $${base}.name = QLALR ${QMAKE_FILE_IN}
  26. $${base}_h.input = $$invar
  27. $${base}_h.output = $$QLALR_DIR/$${parser}_p.h
  28. $${base}_h.CONFIG = no_link
  29. $${base}_h.depends += $$QLALR_DIR/$${parser}.cpp
  30. $${base}_h.commands = $$escape_expand(\\n) # force creation of rule
  31. $${base}_decl.input = $$invar
  32. $${base}_decl.output = $$QLALR_DIR/$${decl}
  33. $${base}_decl.CONFIG = no_link
  34. $${base}_decl.depends += $$QLALR_DIR/$${parser}.cpp
  35. $${base}_decl.commands = $$escape_expand(\\n) # force creation of rule
  36. $${base}_impl.input = $$invar
  37. $${base}_impl.output = $$QLALR_DIR/$${impl}
  38. $${base}_impl.variable_out = GENERATED_SOURCES
  39. $${base}_impl.depends += $$QLALR_DIR/$${parser}.cpp
  40. $${base}_impl.commands = $$escape_expand(\\n) # force creation of rule
  41. QMAKE_EXTRA_COMPILERS += $$base $${base}_h $${base}_decl $${base}_impl
  42. }