Makefile 9.32 KB
Newer Older
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
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
ASN_MODULE_SOURCES=	\
	LDAPMessage.c	\
	MessageID.c	\
	LDAPString.c	\
	LDAPOID.c	\
	LDAPDN.c	\
	RelativeLDAPDN.c	\
	AttributeDescription.c	\
	AttributeValue.c	\
	AttributeValueAssertion.c	\
	AssertionValue.c	\
	PartialAttribute.c	\
	Attribute.c	\
	MatchingRuleId.c	\
	LDAPResult.c	\
	Referral.c	\
	URI.c	\
	Controls.c	\
	Control.c	\
	BindRequest.c	\
	AuthenticationChoice.c	\
	SaslCredentials.c	\
	BindResponse.c	\
	UnbindRequest.c	\
	SearchRequest.c	\
	AttributeSelection.c	\
	Filter.c	\
	SubstringFilter.c	\
	MatchingRuleAssertion.c	\
	SearchResultEntry.c	\
	PartialAttributeList.c	\
	SearchResultReference.c	\
	SearchResultDone.c	\
	ModifyRequest.c	\
	ModifyResponse.c	\
	AddRequest.c	\
	AttributeList.c	\
	AddResponse.c	\
	DelRequest.c	\
	DelResponse.c	\
	ModifyDNRequest.c	\
	ModifyDNResponse.c	\
	CompareRequest.c	\
	CompareResponse.c	\
	AbandonRequest.c	\
	ExtendedRequest.c	\
	ExtendedResponse.c	\
	IntermediateResponse.c

ASN_MODULE_HEADERS=	\
	LDAPMessage.h	\
	MessageID.h	\
	LDAPString.h	\
	LDAPOID.h	\
	LDAPDN.h	\
	RelativeLDAPDN.h	\
	AttributeDescription.h	\
	AttributeValue.h	\
	AttributeValueAssertion.h	\
	AssertionValue.h	\
	PartialAttribute.h	\
	Attribute.h	\
	MatchingRuleId.h	\
	LDAPResult.h	\
	Referral.h	\
	URI.h	\
	Controls.h	\
	Control.h	\
	BindRequest.h	\
	AuthenticationChoice.h	\
	SaslCredentials.h	\
	BindResponse.h	\
	UnbindRequest.h	\
	SearchRequest.h	\
	AttributeSelection.h	\
	Filter.h	\
	SubstringFilter.h	\
	MatchingRuleAssertion.h	\
	SearchResultEntry.h	\
	PartialAttributeList.h	\
	SearchResultReference.h	\
	SearchResultDone.h	\
	ModifyRequest.h	\
	ModifyResponse.h	\
	AddRequest.h	\
	AttributeList.h	\
	AddResponse.h	\
	DelRequest.h	\
	DelResponse.h	\
	ModifyDNRequest.h	\
	ModifyDNResponse.h	\
	CompareRequest.h	\
	CompareResponse.h	\
	AbandonRequest.h	\
	ExtendedRequest.h	\
	ExtendedResponse.h	\
	IntermediateResponse.h

Lev Walkin's avatar
Lev Walkin committed
99 100 101
ASN_MODULE_HEADERS+=OPEN_TYPE.h
ASN_MODULE_SOURCES+=OPEN_TYPE.c
ASN_MODULE_HEADERS+=constr_CHOICE.h
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
ASN_MODULE_HEADERS+=BOOLEAN.h
ASN_MODULE_SOURCES+=BOOLEAN.c
ASN_MODULE_HEADERS+=INTEGER.h
ASN_MODULE_HEADERS+=NativeEnumerated.h
ASN_MODULE_SOURCES+=INTEGER.c
ASN_MODULE_HEADERS+=NULL.h
ASN_MODULE_SOURCES+=NULL.c
ASN_MODULE_SOURCES+=NativeEnumerated.c
ASN_MODULE_HEADERS+=NativeInteger.h
ASN_MODULE_SOURCES+=NativeInteger.c
ASN_MODULE_HEADERS+=asn_SEQUENCE_OF.h
ASN_MODULE_SOURCES+=asn_SEQUENCE_OF.c
ASN_MODULE_HEADERS+=asn_SET_OF.h
ASN_MODULE_SOURCES+=asn_SET_OF.c
ASN_MODULE_SOURCES+=constr_CHOICE.c
ASN_MODULE_HEADERS+=constr_SEQUENCE.h
ASN_MODULE_SOURCES+=constr_SEQUENCE.c
ASN_MODULE_HEADERS+=constr_SEQUENCE_OF.h
ASN_MODULE_SOURCES+=constr_SEQUENCE_OF.c
ASN_MODULE_HEADERS+=constr_SET_OF.h
ASN_MODULE_SOURCES+=constr_SET_OF.c
ASN_MODULE_HEADERS+=asn_application.h
Lev Walkin's avatar
Lev Walkin committed
124
ASN_MODULE_SOURCES+=asn_application.c
Lev Walkin's avatar
Lev Walkin committed
125
ASN_MODULE_HEADERS+=asn_ioc.h
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
126 127 128
ASN_MODULE_HEADERS+=asn_system.h
ASN_MODULE_HEADERS+=asn_codecs.h
ASN_MODULE_HEADERS+=asn_internal.h
Lev Walkin's avatar
Lev Walkin committed
129 130
ASN_MODULE_HEADERS+=asn_bit_data.h
ASN_MODULE_SOURCES+=asn_bit_data.c
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
ASN_MODULE_HEADERS+=OCTET_STRING.h
ASN_MODULE_SOURCES+=OCTET_STRING.c
ASN_MODULE_HEADERS+=BIT_STRING.h
ASN_MODULE_SOURCES+=BIT_STRING.c
ASN_MODULE_SOURCES+=asn_codecs_prim.c
ASN_MODULE_HEADERS+=asn_codecs_prim.h
ASN_MODULE_HEADERS+=ber_tlv_length.h
ASN_MODULE_SOURCES+=ber_tlv_length.c
ASN_MODULE_HEADERS+=ber_tlv_tag.h
ASN_MODULE_SOURCES+=ber_tlv_tag.c
ASN_MODULE_HEADERS+=ber_decoder.h
ASN_MODULE_SOURCES+=ber_decoder.c
ASN_MODULE_HEADERS+=der_encoder.h
ASN_MODULE_SOURCES+=der_encoder.c
ASN_MODULE_HEADERS+=constr_TYPE.h
ASN_MODULE_SOURCES+=constr_TYPE.c
ASN_MODULE_HEADERS+=constraints.h
ASN_MODULE_SOURCES+=constraints.c
ASN_MODULE_HEADERS+=xer_support.h
ASN_MODULE_SOURCES+=xer_support.c
ASN_MODULE_HEADERS+=xer_decoder.h
ASN_MODULE_SOURCES+=xer_decoder.c
ASN_MODULE_HEADERS+=xer_encoder.h
ASN_MODULE_SOURCES+=xer_encoder.c
ASN_MODULE_HEADERS+=per_support.h
ASN_MODULE_SOURCES+=per_support.c
ASN_MODULE_HEADERS+=per_decoder.h
ASN_MODULE_SOURCES+=per_decoder.c
ASN_MODULE_HEADERS+=per_encoder.h
ASN_MODULE_SOURCES+=per_encoder.c
161 162
ASN_MODULE_HEADERS+=per_opentype.h
ASN_MODULE_SOURCES+=per_opentype.c
163
ASN_CONVERTER_SOURCES+=converter-sample.c
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
164 165 166 167 168 169 170 171


lib_LTLIBRARIES=libsomething.la
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 = ldap3dump
Lev Walkin's avatar
Lev Walkin committed
172
LIBS += -lm
173
CPPFLAGS += -DASN_CONVERTER_TITLE="Lightweight Directory Access Protocol V3 decoder" -DHAVE_CONFIG_H -DJUNKTEST -D_DEFAULT_SOURCE  -DASN_DISABLE_OER_SUPPORT -DASN_DISABLE_PER_SUPPORT -DPDU=LDAPMessage -I.
174
OBJS=${ASN_MODULE_SOURCES:.c=.o} ${ASN_CONVERTER_SOURCES:.c=.o}
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
175

Lev Walkin's avatar
Lev Walkin committed
176
all: maybe-wip-pause LDAPMessage.c $(TARGET)
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
177 178

$(TARGET): ${OBJS}
Lev Walkin's avatar
Lev Walkin committed
179
	$(CC) $(CFLAGS) $(CPPFLAGS) -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
180 181 182 183 184

.SUFFIXES:
.SUFFIXES: .c .o

.c.o:
185
	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
186 187 188 189 190 191 192 193

clean:
	rm -f $(TARGET)
	rm -f $(OBJS)

regen: regenerate-from-asn1-source

regenerate-from-asn1-source:
Lev Walkin's avatar
Lev Walkin committed
194
	../../asn1c/asn1c -S ../../skeletons -pdu=LDAPMessage -fcompound-names ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
195 196


Lev Walkin's avatar
Lev Walkin committed
197
LDAPMessage.c: ../sample.makefile.regen ../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1
Lev Walkin's avatar
Lev Walkin committed
198 199 200 201 202
	make regen-makefile
	@touch LDAPMessage.c
	make

regen-makefile:
203
	TITLE="Lightweight Directory Access Protocol V3 decoder" \
204 205 206 207
	ASN1CMDOPTS="-fcompound-names" \
	ASN1MODULES="../rfc4511-Lightweight-Directory-Access-Protocol-V3.asn1" \
	ASN1PDU=LDAPMessage \
	PROGNAME=ldap3dump \
208
	CPPFLAGS="" \
Lev Walkin's avatar
Lev Walkin committed
209
	../sample.makefile.regen
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
210

211
check: ${TARGET} check-ber check-xer check-oer check-per
Lev Walkin's avatar
Lev Walkin committed
212 213 214 215 216
	@echo ================
	@echo All tests passed
	@echo ================

check-ber:
Lev Walkin's avatar
Lev Walkin committed
217
	@if test -f sample-LDAPMessage-1.[db]er ; then \
218 219
	for f in sample-*-*.[db]er; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
220
	for b in 1 17 33 980 8192; do \
221 222 223
	echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -ixer -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin's avatar
Lev Walkin committed
224
	diff ./.tmp.1.$$$$ ./.tmp.2.$$$$ || exit 4; \
Lev Walkin's avatar
Lev Walkin committed
225
	rm -f ./.tmp.[12].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
226
	echo "Test junking $$f (please wait)..."; \
227 228
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 5; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iber -onull $$f || exit 6; \
Lev Walkin's avatar
Lev Walkin committed
229
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
230 231

check-xer:
Lev Walkin's avatar
Lev Walkin committed
232
	@if test -f sample-LDAPMessage-1.xer ; then \
233 234
	for f in sample-*-*.xer; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
235
	for b in 1 17 33 980 8192; do \
236 237 238
	echo "Recoding $$f ($$pdu) into DER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -ixer -oder $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
Lev Walkin's avatar
Lev Walkin committed
239
	diff $$f ./.tmp.2.$$$$ || exit 4; \
Lev Walkin's avatar
Lev Walkin committed
240
	rm -f ./.tmp.[12].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
241
	echo "Test junking $$f (please wait)..."; \
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 5; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ixer -onull $$f || exit 6; \
	done; done; fi

check-oer:
	@if test -f sample-LDAPMessage-1.*oer ; then \
	for f in sample-*-*.*oer; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
	for b in 1 17 33 980 8192; do \
	echo "Recoding $$f ($$pdu) into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -ioer -oxer $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -ixer -ooer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
	diff $$f ./.tmp.2.$$$$ || exit 4; \
	rm -f ./.tmp.[12].$$$$; \
	echo "Test junking $$f (please wait) ($$b) ..."; \
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 5; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -ioer -onull $$f || exit 6; \
Lev Walkin's avatar
Lev Walkin committed
259
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
260 261

check-per:
Lev Walkin's avatar
Lev Walkin committed
262
	@if test -f sample-LDAPMessage-1-nopad.per ; then \
263 264
	for f in sample-*-[1-9]-nopad.per; do \
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
265
	for b in 1 17 33 980 8192; do \
266 267 268 269
	echo "Recoding non-padded $$f ($$pdu) into DER into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -per-nopad -iper -oder $$f > ./.tmp.1.$$$$ || exit 2; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 3; \
	./${TARGET} -p $$pdu -b $$b -ixer -oder ./.tmp.2.$$$$ > ./.tmp.3.$$$$ || exit 4; \
Lev Walkin's avatar
Lev Walkin committed
270
	diff ./.tmp.1.$$$$ ./.tmp.3.$$$$ || exit 5; \
Lev Walkin's avatar
Lev Walkin committed
271
	rm -f ./.tmp.[123].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
272
	echo "Test junking $$f (please wait)..."; \
273 274
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 6; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -per-nopad -iper -onull $$f || exit 7; \
Lev Walkin's avatar
Lev Walkin committed
275
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
276 277
	@if test -f sample-LDAPMessage-1.per ; then \
	for f in sample-*-[1-9].per; do \
278
	pdu=`echo $$f | sed -E -e "s/sample-([A-Za-z0-9-]+)-[0-9].*/\1/"`; \
Lev Walkin's avatar
Lev Walkin committed
279
	for b in 1 17 33 980 8192; do \
280 281 282 283
	echo "Recoding $$f ($$pdu) into DER into XER and back ($$b)..."; \
	./${TARGET} -p $$pdu -b $$b -iper -oder $$f > ./.tmp.1.$$$$ || exit 3; \
	./${TARGET} -p $$pdu -b $$b -iber -oxer ./.tmp.1.$$$$ > ./.tmp.2.$$$$ || exit 4; \
	./${TARGET} -p $$pdu -b $$b -ixer -oper ./.tmp.2.$$$$ > ./.tmp.1.$$$$ || exit 5; \
Lev Walkin's avatar
Lev Walkin committed
284
	diff $$f ./.tmp.1.$$$$ || exit 6; \
Lev Walkin's avatar
Lev Walkin committed
285
	rm -f ./.tmp.[12].$$$$; \
Lev Walkin's avatar
Lev Walkin committed
286
	echo "Test junking $$f (please wait)..."; \
287 288
	./${TARGET} -J0.0001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 7; \
	./${TARGET} -J0.001 -n 1000 -p $$pdu -b $$b -iper -onull $$f || exit 8; \
Lev Walkin's avatar
Lev Walkin committed
289
	done; done; fi
Lev Walkin's avatar
Lev Walkin committed
290

Lev Walkin's avatar
Lev Walkin committed
291 292 293
maybe-wip-pause:
	@if [ -f WIP ]; then cat WIP; sleep 2; fi

Lev Walkin's avatar
LDAP3  
Lev Walkin committed
294
distclean: clean
295 296
	rm -f $(ASN_MODULE_SOURCES)
	rm -f $(ASN_MODULE_HEADERS)
297
	rm -f $(ASN_CONVERTER_SOURCES) $(ASN_CONVERTER_HEADERS)
Lev Walkin's avatar
LDAP3  
Lev Walkin committed
298
	rm -f Makefile.am.sample