/usr/share/qbs/modules/lex_yacc/lexyacc.qbs is in qbs-common 1.10.1+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | import qbs
import "lexyacc.js" as HelperFunctions
Module {
Depends { name: "cpp" }
property bool enableCompilerWarnings: false
property string lexBinary: "lex"
property string yaccBinary: "yacc"
property string outputTag: "c"
property bool uniqueSymbolPrefix: false
property stringList lexFlags: []
property stringList yaccFlags: []
readonly property string outputDir: product.buildDirectory + "/lexyacc"
Rule {
inputs: ["lex.input"]
Artifact {
filePath: HelperFunctions.outputFilePath(product, input, "lex.yy.c", false)
fileTags: [product.moduleProperty("lex_yacc", "outputTag")]
cpp.includePaths: (product.moduleProperty("cpp", "includePaths") || [])
.concat([product.moduleProperty("lex_yacc", "outputDir")])
cpp.warningLevel: input.moduleProperty("lex_yacc", "enableCompilerWarnings")
? "all" : "none"
}
prepare: {
var args = product.moduleProperty("lex_yacc", "lexFlags");
if (product.moduleProperty("lex_yacc", "uniqueSymbolPrefix"))
args.push("-P" + input.baseName, "-o" + output.filePath);
args.push(input.filePath);
var cmd = new Command(product.moduleProperty("lex_yacc", "lexBinary"), args);
cmd.workingDirectory = product.moduleProperty("lex_yacc", "outputDir");
cmd.description = "generating " + output.fileName;
return [cmd];
}
}
Rule {
inputs: ["yacc.input"]
Artifact {
filePath: HelperFunctions.outputFilePath(product, input, "y.tab.c", true)
fileTags: [product.moduleProperty("lex_yacc", "outputTag")]
cpp.warningLevel: input.moduleProperty("lex_yacc", "enableCompilerWarnings")
? "all" : "none"
}
Artifact {
filePath: HelperFunctions.outputFilePath(product, input, "y.tab.h", true)
fileTags: ["hpp"]
}
prepare: {
var args = product.moduleProperty("lex_yacc", "yaccFlags");
args.push("-d");
if (product.moduleProperty("lex_yacc", "uniqueSymbolPrefix")) {
args.push("-b", input.baseName, "-p", input.baseName);
}
args.push(input.filePath);
var cmd = new Command(product.moduleProperty("lex_yacc", "yaccBinary"), args);
cmd.workingDirectory = product.moduleProperty("lex_yacc", "outputDir");
cmd.description = "generating "
+ outputs[product.moduleProperty("lex_yacc", "outputTag")][0].fileName
+ " and " + outputs["hpp"][0].fileName;
return [cmd];
}
}
FileTagger {
patterns: ["*.l"]
fileTags: ["lex.input"];
}
FileTagger {
patterns: ["*.y"]
fileTags: ["yacc.input"];
}
}
|