#
#  compile the any example
#
# MS 92
# 

SNACC_DIR = ../..
SNACC = $(SNACC_DIR)/bin/snacc
ASN1_SRC_DIR = $(SNACC_DIR)/asn1specs
ASN1_CINCLUDE_DIR = $(SNACC_DIR)/c_include
ASN1_CLIB_DIR = $(SNACC_DIR)/c_lib
ASN1_CLIB = $(ASN1_CLIB_DIR)/libasn1csbuf.a

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

SNACCFLAGS = -u $(USEFUL_TYPES)


# the SRCS and HDRS are generated by snacc from snacc/asn1specs/any.asn1
HDRS = any_test.h 
SRCS = any_test.c


CC = gcc 
CFLAGS = -O -I$(ASN1_CINCLUDE_DIR)

all: genber def indef 

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

genber: $(SRCS) genber.c makefile $(ASN1_CLIB)
	$(CC) $(CFLAGS) $(SRCS) genber.c $(ASN1_CLIB) -lm -o genber

def:  $(SRCS) example.c makefile $(ASN1_CLIB)
	$(CC) $(CFLAGS) $(SRCS) example.c $(ASN1_CLIB) -lm -o def

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


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

