diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-10-30 21:53:30 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-10-30 21:53:30 (GMT) |
commit | 65e12afde4bd9cd32e206f874cfa378708248918 (patch) | |
tree | f20703aa76917732b65781c8b45c2a356224bdc1 | |
parent | b48aa163302c32be9624782015507c1138b13d59 (diff) |
Defined the parent directory as the working location for generation.
-rw-r--r-- | plugins/arm/v7/opdefs/Makefile.am | 4 | ||||
-rw-r--r-- | plugins/dalvik/v35/opdefs/Makefile.am | 4 | ||||
-rw-r--r-- | tools/d2c/coder.c | 18 | ||||
-rw-r--r-- | tools/d2c/coder.h | 3 | ||||
-rw-r--r-- | tools/d2c/d2c.c | 7 |
5 files changed, 20 insertions, 16 deletions
diff --git a/plugins/arm/v7/opdefs/Makefile.am b/plugins/arm/v7/opdefs/Makefile.am index 59b69a4..2fb3c4a 100644 --- a/plugins/arm/v7/opdefs/Makefile.am +++ b/plugins/arm/v7/opdefs/Makefile.am @@ -6,7 +6,7 @@ D2C_BIN = $(top_srcdir)/tools/d2c/d2c GEN_BIN = $(top_srcdir)/tools/d2c/d2c_genmakefile.sh -D2C_OUTDIR = $(PWD)/../opcodes/ +D2C_OUTDIR = $(shell readlink -f $(PWD)/.. )/ D2C_TYPE = raw @@ -461,7 +461,7 @@ dist-hook: all: $(ARMV7_DEFS:.d=.g) fmk.done d2c_final_rules fmk.done: $(ARMV7_DEFS) - $(GEN_BIN) $(D2C_OUTDIR) arm thumb_32 thumb_16 + $(GEN_BIN) $(D2C_OUTDIR)opcodes/ arm thumb_32 thumb_16 touch $@ clean: diff --git a/plugins/dalvik/v35/opdefs/Makefile.am b/plugins/dalvik/v35/opdefs/Makefile.am index 0684c53..535d5c1 100644 --- a/plugins/dalvik/v35/opdefs/Makefile.am +++ b/plugins/dalvik/v35/opdefs/Makefile.am @@ -6,7 +6,7 @@ D2C_BIN = $(top_srcdir)/tools/d2c/d2c GEN_BIN = $(top_srcdir)/tools/d2c/d2c_genmakefile.sh -D2C_OUTDIR = $(PWD)/../opcodes/ +D2C_OUTDIR = $(shell readlink -f $(PWD)/.. )/ D2C_TYPE = format @@ -321,7 +321,7 @@ dist-hook: all: $(DALVIK_DEFS:.d=.g) fmk.done d2c_final_rules fmk.done: $(DALVIK_DEFS) - $(GEN_BIN) $(D2C_OUTDIR) - + $(GEN_BIN) $(D2C_OUTDIR)opcodes/ - touch $@ clean: diff --git a/tools/d2c/coder.c b/tools/d2c/coder.c index 9066869..61527bf 100644 --- a/tools/d2c/coder.c +++ b/tools/d2c/coder.c @@ -888,7 +888,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info) if (!has_encoding_spec_prefix(coder->specs[j], enc_name->src)) continue; - header_fd = open_header_file(info->directory, enc_name->dest, "opcodes", &header_new); + header_fd = open_header_file(info->opcodes_dir, enc_name->dest, "opcodes", &header_new); if (header_fd == -1) { result = false; @@ -910,7 +910,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info) } - code_fd = open_code_file(coder, info->directory, enc_name->dest, &code_new); + code_fd = open_code_file(coder, info->opcodes_dir, enc_name->dest, &code_new); if (code_fd == -1) { result = false; @@ -965,7 +965,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info) if (!has_encoding_spec_prefix(coder->specs[j], enc_name->src)) continue; - header_fd = open_header_file(info->directory, enc_name->dest, "opcodes", &header_new); + header_fd = open_header_file(info->opcodes_dir, enc_name->dest, "opcodes", &header_new); if (header_fd == -1) { result = false; @@ -974,7 +974,7 @@ bool output_coder_body(const rented_coder *coder, const output_info *info) assert(!header_new); - code_fd = open_code_file(coder, info->directory, enc_name->dest, &code_new); + code_fd = open_code_file(coder, info->opcodes_dir, enc_name->dest, &code_new); if (code_fd == -1) { result = false; @@ -1513,7 +1513,7 @@ bool output_coder_identifier(const rented_coder *coder, const output_info *info) /* Ouverture de la destination */ - fd = open_header_file(info->directory, NULL, "identifiers", &created); + fd = open_header_file(info->opcodes_dir, NULL, "identifiers", &created); if (fd == -1) goto oci_exit; if (created) @@ -1658,7 +1658,7 @@ bool output_coder_sub_identifier(const rented_coder *coder, const output_info *i /* Ouverture de la destination */ - fd = open_header_file(info->directory, NULL, "subidentifiers", &created); + fd = open_header_file(info->opcodes_dir, NULL, "subidentifiers", &created); if (fd == -1) goto ocsi_exit; if (created) @@ -1823,7 +1823,7 @@ bool output_coder_keyword(const rented_coder *coder, const output_info *info) /* Ouverture de la destination */ - fd = open_header_file(info->directory, NULL, "keywords", &created); + fd = open_header_file(info->opcodes_dir, NULL, "keywords", &created); if (fd == -1) goto ock_exit; if (created) @@ -2017,7 +2017,7 @@ bool output_coder_hooks(const rented_coder *coder, const output_info *info) /* Ouverture de la destination */ - fd = open_header_file(info->directory, NULL, "hooks", &created); + fd = open_header_file(info->opcodes_dir, NULL, "hooks", &created); if (fd == -1) goto och_exit; if (created) @@ -2179,7 +2179,7 @@ bool output_coder_description(const rented_coder *coder, const output_info *info /* Ouverture de la destination */ - fd = open_header_file(info->directory, NULL, "descriptions", &created); + fd = open_header_file(info->opcodes_dir, NULL, "descriptions", &created); if (fd == -1) goto ocd_exit; if (created) diff --git a/tools/d2c/coder.h b/tools/d2c/coder.h index 143b969..2164097 100644 --- a/tools/d2c/coder.h +++ b/tools/d2c/coder.h @@ -106,7 +106,8 @@ typedef enum _InputOutputType /* Regroupement des informations utiles à la génération */ typedef struct _output_info { - const char *directory; /* Répertoire de destination */ + char *opcodes_dir; /* Répertoire pour les opcodes */ + InputOutputType type; /* Type des définitions (E/S) */ const char *arch; /* Architecture à traiter */ const char *arch_cn; /* Nom de code de l'archi. */ diff --git a/tools/d2c/d2c.c b/tools/d2c/d2c.c index 9cb2df4..fddee6a 100644 --- a/tools/d2c/d2c.c +++ b/tools/d2c/d2c.c @@ -196,7 +196,7 @@ int main(int argc, char **argv) break; case 'o': - info.directory = optarg; + asprintf(&info.opcodes_dir, "%sopcodes%c", optarg, optarg[strlen(optarg) - 1]); break; case 't': @@ -274,7 +274,7 @@ int main(int argc, char **argv) if (execute == ADC_NONE) has_error = true; - if (info.directory == NULL || info.arch == NULL || info.arch_cn == NULL || info.guard == NULL) + if (info.opcodes_dir == NULL || info.arch == NULL || info.arch_cn == NULL || info.guard == NULL) has_error = true; if (need_help || has_error || (optind + 1) != argc) @@ -372,6 +372,9 @@ int main(int argc, char **argv) exit: + if (info.opcodes_dir != NULL) + free(info.opcodes_dir); + return result; } |