Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
3aa33c03
Commit
3aa33c03
authored
Nov 14, 2017
by
Jon Ringle
Committed by
Lev Walkin
Nov 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -gen-autotools option generates example configure.ac and Makefile.am
parent
1029a6ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletion
+67
-1
asn1c/asn1c.c
asn1c/asn1c.c
+5
-0
libasn1compiler/asn1c_save.c
libasn1compiler/asn1c_save.c
+57
-0
libasn1compiler/asn1compiler.h
libasn1compiler/asn1compiler.h
+5
-1
No files found.
asn1c/asn1c.c
View file @
3aa33c03
...
...
@@ -127,6 +127,8 @@ main(int ac, char **av) {
asn1_compiler_flags
|=
A1C_GEN_OER
;
}
else
if
(
strcmp
(
optarg
,
"en-example"
)
==
0
)
{
asn1_compiler_flags
|=
A1C_GEN_EXAMPLE
;
}
else
if
(
strcmp
(
optarg
,
"en-autotools"
)
==
0
)
{
asn1_compiler_flags
|=
A1C_GEN_AUTOTOOLS_EXAMPLE
;
}
else
{
fprintf
(
stderr
,
"-g%s: Invalid argument
\n
"
,
optarg
);
exit
(
EX_USAGE
);
...
...
@@ -141,6 +143,8 @@ main(int ac, char **av) {
asn1_compiler_flags
&=
~
A1C_GEN_OER
;
}
else
if
(
strcmp
(
optarg
,
"o-gen-example"
)
==
0
)
{
asn1_compiler_flags
&=
~
A1C_GEN_EXAMPLE
;
}
else
if
(
strcmp
(
optarg
,
"o-gen-autotools"
)
==
0
)
{
asn1_compiler_flags
&=
~
A1C_GEN_AUTOTOOLS_EXAMPLE
;
}
else
{
fprintf
(
stderr
,
"-n%s: Invalid argument
\n
"
,
optarg
);
exit
(
EX_USAGE
);
...
...
@@ -533,6 +537,7 @@ usage(const char *av0) {
" -no-gen-OER Do not generate the OER (X.696) support code
\n
"
" -no-gen-PER Do not generate the PER (X.691) support code
\n
"
" -no-gen-example Do not generate the ASN.1 format converter example
\n
"
" -gen-autotools Generate example top-level configure.ac and Makefile.am
\n
"
" -pdu={all|auto|Type} Generate PDU table (discover PDUs automatically)
\n
"
"
\n
"
...
...
libasn1compiler/asn1c_save.c
View file @
3aa33c03
...
...
@@ -294,6 +294,58 @@ asn1c__save_example_am_makefile(arg_t *arg, const asn1c_dep_chainset *deps, cons
return
0
;
}
static
int
asn1c__save_autotools_example
(
const
char
*
destdir
,
const
char
*
program_makefile_name
)
{
FILE
*
fd
;
const
char
*
confac
=
"configure.ac"
;
const
char
*
makeam
=
"Makefile.am"
;
if
((
access
(
confac
,
F_OK
)
!=
-
1
)
||
(
access
(
makeam
,
F_OK
)
!=
-
1
))
{
safe_fprintf
(
stderr
,
"Refusing to overwrite existing '%s' or '%s'
\n
"
,
confac
,
makeam
);
return
-
1
;
}
fd
=
asn1c_open_file
(
""
,
confac
,
""
,
0
);
if
(
fd
==
NULL
)
{
perror
(
confac
);
return
-
1
;
}
safe_fprintf
(
fd
,
"AC_INIT([asn1convert],[0.1])
\n
"
"AM_INIT_AUTOMAKE([-Werror foreign subdir-objects])
\n
"
"AC_PREREQ([2.62])
\n
"
"AC_PROG_CC
\n
"
"LT_INIT
\n
"
"AM_SILENT_RULES([yes])
\n
"
"AC_CONFIG_FILES([Makefile])
\n
"
"AC_OUTPUT
\n
"
);
fclose
(
fd
);
safe_fprintf
(
stderr
,
"Generated minimal example %s
\n
"
,
confac
);
fd
=
asn1c_open_file
(
""
,
makeam
,
""
,
0
);
if
(
fd
==
NULL
)
{
perror
(
makeam
);
return
-
1
;
}
safe_fprintf
(
fd
,
"bin_PROGRAMS =
\n
"
"lib_LTLIBRARIES =
\n
"
"include %s%s
\n\n
"
,
destdir
,
program_makefile_name
);
fclose
(
fd
);
safe_fprintf
(
stderr
,
"Generated minimal example %s
\n
"
,
makeam
);
safe_fprintf
(
stderr
,
"
\n
Run the following to generate a configure script:
\n
"
);
safe_fprintf
(
stderr
,
"$ autoreconf --force --install
\n
"
);
return
0
;
}
static
int
can_generate_pdu_collection
(
arg_t
*
arg
)
{
abuf
*
buf
=
generate_pdu_collection
(
arg
);
if
(
!
buf
)
{
...
...
@@ -362,6 +414,11 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir, const char *destdir,
example_am_makefile
,
library_makefile
,
argc
,
argv
);
if
(
ret
)
break
;
if
(
arg
->
flags
&
A1C_GEN_AUTOTOOLS_EXAMPLE
)
{
ret
=
asn1c__save_autotools_example
(
destdir
,
example_am_makefile
);
if
(
ret
)
break
;
}
}
}
while
(
0
);
...
...
libasn1compiler/asn1compiler.h
View file @
3aa33c03
...
...
@@ -87,7 +87,11 @@ enum asn1c_flags {
/*
* Generate converter-example.c and converter-example.mk
*/
A1C_GEN_EXAMPLE
=
0x100000
,
A1C_GEN_EXAMPLE
=
0x100000
,
/*
* Generate top-level configure.ac and Makefile.am
*/
A1C_GEN_AUTOTOOLS_EXAMPLE
=
0x200000
,
};
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment