 
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 = $(SNACC_DIR)/c++_lib/libasn1c++.a

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

SNACCFLAGS = -C -u $(USEFUL_TYPES)


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


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

all: genber def indef 

$(SRCS): $(SNACC)
	$(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 pr.ber $(HDRS) $(SRCS) 

