-
Notifications
You must be signed in to change notification settings - Fork 557
/
sample.makefile.regen
executable file
·154 lines (147 loc) · 6.45 KB
/
sample.makefile.regen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/sh
#
# This script attempts to compile the given ASN.1 specification by first
# building the specialized Makefile.
#
# The information which is necessary for this script is passed from the
# Makefile which is going to be replaced with an updated Makefile.
#
if test -z "$ASN_PDU" \
-o -z "$ASN_MODULES" \
-o -z "$ASN_PROGRAM" \
; then
cat <<-NOTE
ASN_CMDOPTS="$ASN_CMDOPTS"
ASN_MODULES="$ASN_MODULES"
ASN_PDU="$ASN_PDU"
ASN_PROGRAM="$ASN_PROGRAM"
ASN_PDU, ASN_MODULES, and ASN_PROGRAM are mandatory.
NOTE
exit 1
fi
EFFECTIVE_CMDOPTS="-pdu=${ASN_PDU} ${ASN_CMDOPTS} ${ASN_MODULES}"
if test -x ../../asn1c/asn1c ; then
echo "Compiling ${ASN_MODULES} using local compiler"
../../asn1c/asn1c -S ../../skeletons ${EFFECTIVE_CMDOPTS} || exit $?
else
echo "Compiling ${ASN_MODULES} using system compiler"
asn1c ${EFFECTIVE_CMDOPTS} || exit $?
fi
if test ! -f converter-example.mk ; then
echo "converter-example.mk is missing"
exit 1
fi
EXTRA_CFLAGS="-DJUNKTEST -D_DEFAULT_SOURCE"
test -f config.h && EXTRA_CFLAGS="-DHAVE_CONFIG_H ${EXTRA_CFLAGS}"
test -n "$TITLE" && EXTRA_CFLAGS="-DASN_CONVERTER_TITLE=\"$TITLE\" ${EXTRA_CFLAGS}"
{
echo "ASN_PROGRAM = ${ASN_PROGRAM}"
echo "CFLAGS += ${EXTRA_CFLAGS}"
echo "begin: ${ASN_PDU}.c maybe-wip-pause all"
echo
echo "-include converter-example.mk"
echo
echo "${ASN_PDU}.c: $0 ${ASN_MODULES}"
echo " make regen-makefile"
echo " @touch ${ASN_PDU}.c"
echo " make"
echo
echo "regen-makefile:"
test -n "$TITLE" && echo " TITLE=\"$TITLE\" \\"
echo " ASN_CMDOPTS=\"${ASN_CMDOPTS}\" \\"
echo " ASN_MODULES=\"${ASN_MODULES}\" \\"
echo " ASN_PDU=${ASN_PDU} \\"
echo " ASN_PROGRAM=${ASN_PROGRAM} \\"
echo " $0"
echo
echo 'check: ${ASN_PROGRAM} check-ber check-xer check-oer check-per'
echo ' @echo ================'
echo ' @echo All tests passed'
echo ' @echo ================'
echo
echo 'check-ber:'
echo " @if test -f sample-${ASN_PDU}-1.[db]er ; then \\"
echo " for f in sample-*-*.[db]er; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \'
echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \'
echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \'
echo ' done; done; fi'
echo
echo 'check-xer:'
echo " @if test -f sample-${ASN_PDU}-1.xer ; then \\"
echo " for f in sample-*-*.xer; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' diff $$f ./.tmp.2.$$$$ || exit 4; \'
echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \'
echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \'
echo ' done; done; fi'
echo
echo 'check-oer:'
echo " @if test -f sample-${ASN_PDU}-1.*oer ; then \\"
echo " for f in sample-*-*.*oer; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' diff $$f ./.tmp.2.$$$$ || exit 4; \'
echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait) ($$b) ..."; \'
echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \'
echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \'
echo ' done; done; fi'
echo
echo 'check-per:'
echo " @if test -f sample-${ASN_PDU}-1-nopad.per ; then \\"
echo " for f in sample-*-[1-9]-nopad.per; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \'
echo ' diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \'
echo ' rm -f ./.tmp.[123].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \'
echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \'
echo ' done; done; fi'
echo " @if test -f sample-${ASN_PDU}-1.per ; then \\"
echo " for f in sample-*-[1-9].per; do \\"
echo ' pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\\1/"`; \'
echo ' for b in 1 17 33 980 8192; do \'
echo ' echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \'
echo ' ./${ASN_PROGRAM} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \'
echo ' diff $$f ./.tmp.1.$$$$ || exit 6; \'
echo ' rm -f ./.tmp.[12].$$$$; \'
echo ' echo "Test junking $$f (please wait)..."; \'
echo ' ./${ASN_PROGRAM} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \'
echo ' ./${ASN_PROGRAM} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \'
echo ' done; done; fi'
echo
echo "maybe-wip-pause:"
echo " @if [ -f WIP ]; then cat WIP; sleep 2; fi"
echo
echo "distclean: clean"
echo ' rm -f $(ASN_MODULE_SRCS)'
echo ' rm -f $(ASN_MODULE_HDRS)'
echo ' rm -f $(ASN_PROGRAM_SRCS) $(ASN_PROGRAM_HDRS)'
echo " rm -f converter-example.mk"
} > Makefile
echo
echo "Makefile generation finished"