compel: piegen -- Add @uapi-dir option

We will need it to include types once compel
gets into own directory.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov 2016-04-05 18:41:12 +03:00 committed by Pavel Emelyanov
parent 3da3d8183f
commit ffc288fb42
3 changed files with 8 additions and 2 deletions

View file

@ -158,7 +158,7 @@ int handle_elf(void *mem, size_t size)
}
pr_out("/* Autogenerated from %s */\n", opts.input_filename);
pr_out("#include \"piegen/uapi/types.h\"\n");
pr_out("#include \"%s/types.h\"\n", opts.uapi_dir);
for (i = 0; i < symtab_hdr->sh_size / symtab_hdr->sh_entsize; i++) {
Sym_t *sym = &symbols[i];

View file

@ -19,6 +19,7 @@
piegen_opt_t opts = {
.input_filename = NULL,
.uapi_dir = "piegen/uapi",
.stream_name = "stream",
.prefix_name = "__",
.var_name = "elf_relocs",
@ -75,11 +76,12 @@ int main(int argc, char *argv[])
void *mem;
int fd;
static const char short_opts[] = "f:o:s:p:v:r:h";
static const char short_opts[] = "f:o:s:p:v:r:u:h";
static struct option long_opts[] = {
{ "file", required_argument, 0, 'f' },
{ "output", required_argument, 0, 'o' },
{ "stream", required_argument, 0, 's' },
{ "uapi-dir", required_argument, 0, 'u' },
{ "sym-prefix", required_argument, 0, 'p' },
{ "variable", required_argument, 0, 'v' },
{ "pcrelocs", required_argument, 0, 'r' },
@ -102,6 +104,9 @@ int main(int argc, char *argv[])
case 'o':
opts.output_filename = optarg;
break;
case 'u':
opts.uapi_dir = optarg;
break;
case 's':
opts.stream_name = optarg;
break;

View file

@ -7,6 +7,7 @@
typedef struct {
char *input_filename;
char *output_filename;
char *uapi_dir;
char *stream_name;
char *prefix_name;
char *var_name;