#
# builds the C++ ANY example
#
# MS 92
#

SNACC_DIR = ../..
SNACC = $(SNACC_DIR)/bin/snacc
ASN1_SRC_DIR = $(SNACC_DIR)/asn1specs
ASN1_CPP_INCLUDE_DIR = $(SNACC_DIR)/c++_include
ASN1_CPP_LIB_DIR = $(SNACC_DIR)/c++_lib
ASN1_CPP_LIB = $(ASN1_CPP_LIB_DIR)/libasn1c++.a

USEFUL_TYPES = $(ASN1_SRC_DIR)/useful.asn1
ASN1_SRCS = $(ASN1_SRC_DIR)/any.asn1

SNACCFLAGS = -C -u $(USEFUL_TYPES)


# the SRCS and HDRS are generated by snacc from p_rec.asn1
HDRS = any_test.h 
SRCS = any_test.C


CC = g++
CFLAGS = -g -I$(ASN1_CPP_INCLUDE_DIR)

all: genber def indef 

$(SRCS): $(SNACC) $(ASN1_SRCS)
	$(SNACC) $(SNACCFLAGS) $(ASN1_SRCS) 

genber: $(SRCS) genber.C makefile
	$(CC) $(CFLAGS) $(SRCS) genber.C $(ASN1_CPP_LIB) -lm -o genber

def:  $(SRCS) example.C makefile
	$(CC) $(CFLAGS) $(SRCS) example.C $(ASN1_CPP_LIB) -lm -o def

indef: $(SRCS) example.C makefile
	$(CC) $(CFLAGS) -DUSE_INDEF_LEN $(SRCS) example.C $(ASN1_CPP_LIB)\
        -lm -o indef



clean:
	rm -f *.o *~ .emacs* core def indef genber $(HDRS) $(SRCS) att.ber
