Commit a4f3d467 authored by Lev Walkin's avatar Lev Walkin

avoid generating some OER object code if not -gen-OER

parent 7268f33f
......@@ -38,13 +38,13 @@ if test ! -f Makefile.am.sample ; then
exit 1
fi
EXTRA_CFLAGS="-DJUNKTEST -D_DEFAULT_SOURCE ${CFLAGS}"
test -f config.h && EXTRA_CFLAGS="-DHAVE_CONFIG_H ${EXTRA_CFLAGS}"
test -n "$TITLE" && EXTRA_CFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CFLAGS}"
EXTRA_CPPFLAGS="-DJUNKTEST -D_DEFAULT_SOURCE ${CPPFLAGS}"
test -f config.h && EXTRA_CPPFLAGS="-DHAVE_CONFIG_H ${EXTRA_CPPFLAGS}"
test -n "$TITLE" && EXTRA_CPPFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CPPFLAGS}"
set -x
cat Makefile.am.sample \
| sed -e "s/^CFLAGS += /CFLAGS += ${EXTRA_CFLAGS} /" \
| sed -e "s/^CPPFLAGS += /CPPFLAGS += ${EXTRA_CPPFLAGS} /" \
| sed -e "s/^all: /all: ${ASN1PDU}.c /" \
| sed -e "s/progname/${PROGNAME}/" \
> Makefile.$$
......@@ -62,7 +62,7 @@ set +x
echo " ASN1MODULES=\"${ASN1MODULES}\" \\"
echo " ASN1PDU=${ASN1PDU} \\"
echo " PROGNAME=${PROGNAME} \\"
echo " CFLAGS=\"${CFLAGS}\" \\"
echo " CPPFLAGS=\"${CPPFLAGS}\" \\"
echo " $0"
echo
echo 'check: ${TARGET} check-ber check-xer check-per'
......
......@@ -984,7 +984,6 @@ ASN_MODULE_SOURCES+=INTEGER.c
ASN_MODULE_SOURCES+=NativeEnumerated.c
ASN_MODULE_HEADERS+=NativeInteger.h
ASN_MODULE_SOURCES+=NativeInteger.c
ASN_MODULE_SOURCES+=NativeInteger_oer.c
ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h
ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c
ASN_MODULE_HEADERS+=asn_SET_OF.h
......@@ -1048,19 +1047,19 @@ libsomething_la_SOURCES=$(ASN_MODULE_SOURCES) $(ASN_MODULE_HEADERS)
# This file may be used as an input for make(3)
# Remove the lines below to convert it into a pure .am file
TARGET = j2735-dump
CFLAGS += -DASN_CONVERTER_TITLE="J2735 DSRC decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE -DPDU=MessageFrame -I.
CPPFLAGS += -DASN_CONVERTER_TITLE="J2735 DSRC decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE -DASN_DISABLE_OER_SUPPORT -DPDU=MessageFrame -I.
OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}
all: MessageFrame.c $(TARGET)
$(TARGET): ${OBJS}
$(CC) $(CFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)
$(CC) $(CPPFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -o $@ -c $<
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
clean:
rm -f $(TARGET)
......@@ -1083,7 +1082,7 @@ regen-makefile:
ASN1MODULES="../j2735.asn1" \
ASN1PDU=MessageFrame \
PROGNAME=j2735-dump \
CFLAGS="" \
CPPFLAGS="" \
../sample.makefile.regen
check: ${TARGET} check-ber check-xer check-per
......
......@@ -160,36 +160,37 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir,
return -1;
}
safe_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 +=%s%s -I.\n"
"OBJS=${ASN_MODULE_SOURCES:.c=.o}"
" ${ASN_CONVERTER_SOURCES:.c=.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"
"\nregen: regenerate-from-asn1-source\n"
"\nregenerate-from-asn1-source:\n\t"
, (arg->flags & A1C_PDU_TYPE)
? generate_pdu_C_definition() : ""
, need_to_generate_pdu_collection(arg)
? " -DASN_PDU_COLLECTION" : ""
);
for(i = 0; i < argc; i++)
safe_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"
"CPPFLAGS += %s%s%s%s-I.\n"
"OBJS=${ASN_MODULE_SOURCES:.c=.o}"
" ${ASN_CONVERTER_SOURCES:.c=.o}\n"
"\nall: $(TARGET)\n"
"\n$(TARGET): ${OBJS}"
"\n\t$(CC) $(CPPFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)\n"
"\n.SUFFIXES:"
"\n.SUFFIXES: .c .o\n"
"\n.c.o:"
"\n\t$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<\n"
"\nclean:"
"\n\trm -f $(TARGET)"
"\n\trm -f $(OBJS)\n"
"\nregen: regenerate-from-asn1-source\n"
"\nregenerate-from-asn1-source:\n\t",
(arg->flags & A1C_GEN_OER) ? "" : "-DASN_DISABLE_OER_SUPPORT ",
(arg->flags & A1C_GEN_PER) ? "" : "-DASN_DISABLE_PER_SUPPORT ",
(arg->flags & A1C_PDU_TYPE) ? generate_pdu_C_definition() : "",
need_to_generate_pdu_collection(arg) ? "-DASN_PDU_COLLECTION " : "");
for(i = 0; i < argc; i++)
safe_fprintf(mkf, "%s%s", i ? " " : "", argv[i]);
safe_fprintf(mkf, "\n\n");
......@@ -568,18 +569,21 @@ static int pduTypes;
static const char *
generate_pdu_C_definition(void) {
const char *src;
char *def;
const char *src;
char *def;
char *dst;
if(pduTypes == 0) return "";
def = malloc(strlen(pduType[0].typename) + 20);
assert(def);
strcpy(def, " -DPDU=");
for(src = pduType[0].typename, dst = def + 7; *src; src++, dst++)
if((*dst = *src) == '-')
*dst = '_';
*dst = 0;
return def;
if(pduTypes == 0) return "";
def = malloc(strlen(pduType[0].typename) + 20);
assert(def);
strcpy(def, "-DPDU=");
for(src = pduType[0].typename, dst = def + 6; *src; src++, dst++) {
if((*dst = *src) == '-') {
*dst = '_';
}
}
*dst++ = ' ';
*dst = 0;
return def;
}
void
......
......@@ -16,7 +16,7 @@ INTEGER.h INTEGER.c
ISO646String.h ISO646String.c
NULL.h NULL.c BOOLEAN.h
NativeEnumerated.h NativeEnumerated.c NativeInteger.h
NativeInteger.h NativeInteger.c INTEGER.h NativeInteger_oer.c
NativeInteger.h NativeInteger.c INTEGER.h
NativeReal.h NativeReal.c REAL.h
NumericString.h NumericString.c
OBJECT_IDENTIFIER.h OBJECT_IDENTIFIER.c INTEGER.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment