mirror of https://gerrit.osmocom.org/asn1c
versatile Makefile creation
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@374 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
parent
00cf36fc99
commit
2ffc8bba0d
|
@ -52,12 +52,22 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir) {
|
|||
TQ_FOR(arg->expr, &(arg->mod->members), next) {
|
||||
if(asn1_lang_map[arg->expr->meta_type]
|
||||
[arg->expr->expr_type].type_cb) {
|
||||
fprintf(mkf, "\t\\\n\t%s.c %s.h",
|
||||
arg->expr->Identifier,
|
||||
fprintf(mkf, "\t\\\n\t%s.c",
|
||||
arg->expr->Identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(mkf, "\n\nASN_MODULE_HEADERS=");
|
||||
TQ_FOR(arg->mod, &(arg->asn->modules), mod_next) {
|
||||
TQ_FOR(arg->expr, &(arg->mod->members), next) {
|
||||
if(asn1_lang_map[arg->expr->meta_type]
|
||||
[arg->expr->expr_type].type_cb) {
|
||||
fprintf(mkf, "\t\\\n\t%s.h",
|
||||
arg->expr->Identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(mkf, "\n\n");
|
||||
|
||||
/*
|
||||
* Move necessary skeleton files and add them to Makefile.am.sample.
|
||||
|
@ -75,6 +85,7 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir) {
|
|||
|
||||
for(i = 0; i < dlist->el_count; i++) {
|
||||
char *fname = dlist->elements[i]->filename;
|
||||
char *dotH;
|
||||
|
||||
assert(strlen(fname) < (sizeof(buf) / 2));
|
||||
strcpy(dir_end, fname);
|
||||
|
@ -83,15 +94,38 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir) {
|
|||
fprintf(mkf, ">>>ABORTED<<<");
|
||||
fclose(mkf);
|
||||
return -1;
|
||||
}
|
||||
dotH = strrchr(fname, 'h');
|
||||
if(dotH && fname<dotH && dotH[-1] == '.' && !dotH[1]) {
|
||||
fprintf(mkf, "ASN_MODULE_HEADERS+=%s\n", fname);
|
||||
} else {
|
||||
fprintf(mkf, "\t\\\n\t%s", fname);
|
||||
fprintf(mkf, "ASN_MODULE_SOURCES+=%s\n", fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(mkf, "\n\n");
|
||||
fprintf(mkf, "lib_LTLIBRARIES=libsomething.la\n");
|
||||
fprintf(mkf, "libsomething_la_SOURCES=$(ASN_MODULE_SOURCES)\n");
|
||||
fprintf(mkf, "\n\n"
|
||||
"lib_LTLIBRARIES=libsomething.la\n"
|
||||
"libsomething_la_SOURCES="
|
||||
"$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS)\n"
|
||||
"\n"
|
||||
"# This file may be used as an input for make(3)\n"
|
||||
"# Remove the lines below to convert it into a pure .am file\n"
|
||||
"TARGET = progname\n"
|
||||
"CFLAGS += -I.\n"
|
||||
"OBJS=${ASN_MODULE_SOURCES:.c=.o} $(TARGET).o\n"
|
||||
"\nall: $(TARGET)\n"
|
||||
"\n$(TARGET): ${OBJS}"
|
||||
"\n\t$(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)\n"
|
||||
"\n.SUFFIXES:"
|
||||
"\n.SUFFIXES: .c .o\n"
|
||||
"\n.c.o:"
|
||||
"\n\t$(CC) $(CFLAGS) -o $@ -c $<\n"
|
||||
"\nclean:"
|
||||
"\n\trm -f $(TARGET)"
|
||||
"\n\trm -f $(OBJS)\n"
|
||||
"\n"
|
||||
);
|
||||
fclose(mkf);
|
||||
fprintf(stderr, "Generated Makefile.am.sample\n");
|
||||
|
||||
|
@ -158,7 +192,8 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps) {
|
|||
fprintf(fp_c,
|
||||
"/*\n"
|
||||
" * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n"
|
||||
" * From ASN.1 module \"%s\" found in \"%s\"\n"
|
||||
" * From ASN.1 module \"%s\"\n"
|
||||
" * \tfound in \"%s\"\n"
|
||||
" */\n\n",
|
||||
arg->mod->Identifier,
|
||||
arg->mod->source_file_name
|
||||
|
@ -166,7 +201,8 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps) {
|
|||
fprintf(fp_h,
|
||||
"/*\n"
|
||||
" * Generated by asn1c-" VERSION " (http://lionet.info/asn1c)\n"
|
||||
" * From ASN.1 module \"%s\" found in \"%s\"\n"
|
||||
" * From ASN.1 module \"%s\"\n"
|
||||
" * \tfound in \"%s\"\n"
|
||||
" */\n\n",
|
||||
arg->mod->Identifier,
|
||||
arg->mod->source_file_name
|
||||
|
|
Loading…
Reference in New Issue