blob: 5680c6bd9addb6512fb6c35641a39d98b5a87b3e [file] [log] [blame]
Lev Walkinad775912017-09-26 22:55:22 -07001-include Makefile.am.libasncodec
Lev Walkin8c85f2a2006-09-09 11:26:09 +00002
Lev Walkin8c85f2a2006-09-09 11:26:09 +00003TARGET = ldap3dump
Lev Walkinad775912017-09-26 22:55:22 -07004ASN_LIBRARY=libasncodec.a
Lev Walkine29a30e2017-09-13 16:21:49 -07005LIBS += -lm
Lev Walkinad775912017-09-26 22:55:22 -07006CFLAGS += -DASN_CONVERTER_TITLE="Lightweight Directory Access Protocol V3 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE $(ASN_MODULE_CFLAGS) -DPDU=LDAPMessage -I.
7ASN_CONVERTER_SOURCES := \
8 converter-example.c
Lev Walkin8c85f2a2006-09-09 11:26:09 +00009
Lev Walkin38a5a202017-08-25 12:17:08 -070010all: maybe-wip-pause LDAPMessage.c $(TARGET)
Lev Walkin8c85f2a2006-09-09 11:26:09 +000011
Lev Walkinad775912017-09-26 22:55:22 -070012$(TARGET): $(ASN_LIBRARY) $(ASN_CONVERTER_SOURCES:.c=.o)
13 $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) $(ASN_CONVERTER_SOURCES:.c=.o) $(LDFLAGS) $(ASN_LIBRARY) $(LIBS)
14
15$(ASN_LIBRARY): $(ASN_MODULE_SOURCES:.c=.o)
16 $(AR) rcs $@ $^
Lev Walkin8c85f2a2006-09-09 11:26:09 +000017
18.SUFFIXES:
19.SUFFIXES: .c .o
20
21.c.o:
Lev Walkinad775912017-09-26 22:55:22 -070022 $(CC) $(CFLAGS) -o $@ -c $<
Lev Walkin8c85f2a2006-09-09 11:26:09 +000023
24clean:
Lev Walkinad775912017-09-26 22:55:22 -070025 rm -f $(TARGET) $(ASN_LIBRARY)
26 rm -f $(ASN_MODULE_SOURCES:.c=.o) $(ASN_CONVERTER_SOURCES:.c=.o)
Lev Walkin8c85f2a2006-09-09 11:26:09 +000027
28regen: regenerate-from-asn1-source
29
30regenerate-from-asn1-source:
Lev Walkind7f5cb92006-09-23 02:56:19 +000031 ../../asn1c/asn1c -S ../../skeletons -pdu=LDAPMessage -fcompound-names ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
Lev Walkin8c85f2a2006-09-09 11:26:09 +000032
33
Lev Walkinc33a59e2006-09-18 20:04:14 +000034LDAPMessage.c: ../sample.makefile.regen ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
Lev Walkincc7c94e2006-09-17 04:01:29 +000035 make regen-makefile
36 @touch LDAPMessage.c
37 make
38
39regen-makefile:
Lev Walkin5aef2c52007-06-29 12:46:06 +000040 TITLE="Lightweight Directory Access Protocol V3 decoder" \
Lev Walkinf5b49392006-09-12 06:19:15 +000041 ASN1CMDOPTS="-fcompound-names" \
42 ASN1MODULES="../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1" \
43 ASN1PDU=LDAPMessage \
44 PROGNAME=ldap3dump \
Lev Walkin2fd86de2006-09-13 02:10:23 +000045 ../sample.makefile.regen
Lev Walkin8c85f2a2006-09-09 11:26:09 +000046
Lev Walkin5efafc52017-09-05 03:43:00 -070047check: ${TARGET} check-ber check-xer check-oer check-per
Lev Walkin1f12da42006-09-24 19:47:07 +000048 @echo ================
49 @echo All tests passed
50 @echo ================
51
52check-ber:
Lev Walkin00918812006-09-18 21:19:32 +000053 @if test -f sample-LDAPMessage-1.[db]er ; then \
Lev Walkin5efafc52017-09-05 03:43:00 -070054 for f in sample-*-*.[db]er; do \
55 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000056 for b in 1 17 33 980 8192; do \
Lev Walkin5efafc52017-09-05 03:43:00 -070057 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
58 ./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
59 ./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin46a6bd22007-06-26 08:36:39 +000060 diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
Lev Walkinc33a59e2006-09-18 20:04:14 +000061 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000062 echo "Test junking $$f (please wait)..."; \
Lev Walkin5efafc52017-09-05 03:43:00 -070063 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
64 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +000065 done; done; fi
Lev Walkin1f12da42006-09-24 19:47:07 +000066
67check-xer:
Lev Walkin00918812006-09-18 21:19:32 +000068 @if test -f sample-LDAPMessage-1.xer ; then \
Lev Walkin5efafc52017-09-05 03:43:00 -070069 for f in sample-*-*.xer; do \
70 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +000071 for b in 1 17 33 980 8192; do \
Lev Walkin5efafc52017-09-05 03:43:00 -070072 echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
73 ./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
74 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin46a6bd22007-06-26 08:36:39 +000075 diff $$f ./.tmp.2.$$$$ || exit 4; \
Lev Walkinc33a59e2006-09-18 20:04:14 +000076 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +000077 echo "Test junking $$f (please wait)..."; \
Lev Walkin5efafc52017-09-05 03:43:00 -070078 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
79 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
80 done; done; fi
81
82check-oer:
83 @if test -f sample-LDAPMessage-1.*oer ; then \
84 for f in sample-*-*.*oer; do \
85 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
86 for b in 1 17 33 980 8192; do \
87 echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
88 ./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
89 ./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
90 diff $$f ./.tmp.2.$$$$ || exit 4; \
91 rm -f ./.tmp.[12].$$$$; \
92 echo "Test junking $$f (please wait) ($$b) ..."; \
93 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
94 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +000095 done; done; fi
Lev Walkin1f12da42006-09-24 19:47:07 +000096
97check-per:
Lev Walkin46a6bd22007-06-26 08:36:39 +000098 @if test -f sample-LDAPMessage-1-nopad.per ; then \
Lev Walkin5efafc52017-09-05 03:43:00 -070099 for f in sample-*-[1-9]-nopad.per; do \
100 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +0000101 for b in 1 17 33 980 8192; do \
Lev Walkin5efafc52017-09-05 03:43:00 -0700102 echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
103 ./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
104 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
105 ./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
Lev Walkin46a6bd22007-06-26 08:36:39 +0000106 diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
Lev Walkin13afe532006-09-18 21:30:04 +0000107 rm -f ./.tmp.[123].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +0000108 echo "Test junking $$f (please wait)..."; \
Lev Walkin5efafc52017-09-05 03:43:00 -0700109 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
110 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
Lev Walkin13afe532006-09-18 21:30:04 +0000111 done; done; fi
Lev Walkin46a6bd22007-06-26 08:36:39 +0000112 @if test -f sample-LDAPMessage-1.per ; then \
113 for f in sample-*-[1-9].per; do \
Lev Walkin5efafc52017-09-05 03:43:00 -0700114 pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin13afe532006-09-18 21:30:04 +0000115 for b in 1 17 33 980 8192; do \
Lev Walkin5efafc52017-09-05 03:43:00 -0700116 echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
117 ./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
118 ./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
119 ./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
Lev Walkin46a6bd22007-06-26 08:36:39 +0000120 diff $$f ./.tmp.1.$$$$ || exit 6; \
Lev Walkin13afe532006-09-18 21:30:04 +0000121 rm -f ./.tmp.[12].$$$$; \
Lev Walkin1f12da42006-09-24 19:47:07 +0000122 echo "Test junking $$f (please wait)..."; \
Lev Walkin5efafc52017-09-05 03:43:00 -0700123 ./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
124 ./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
Lev Walkin13afe532006-09-18 21:30:04 +0000125 done; done; fi
Lev Walkinc744a022006-09-15 18:33:25 +0000126
Lev Walkin38a5a202017-08-25 12:17:08 -0700127maybe-wip-pause:
128 @if [ -f WIP ]; then cat WIP; sleep 2; fi
129
Lev Walkin8c85f2a2006-09-09 11:26:09 +0000130distclean: clean
Lev Walkinbcda5ff2006-09-17 03:29:51 +0000131 rm -f $(ASN_MODULE_SOURCES)
132 rm -f $(ASN_MODULE_HEADERS)
Lev Walkinf5b49392006-09-12 06:19:15 +0000133 rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
Lev Walkinad775912017-09-26 22:55:22 -0700134 rm -f Makefile.am.example