#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
#
# THE BSD LICENSE
#
# Redistribution and use in source and binary forms, with or without 
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer. 
# Redistributions in binary form must reproduce the above copyright notice, 
# this list of conditions and the following disclaimer in the documentation 
# and/or other materials provided with the distribution. 
#
# Neither the name of the  nor the names of its contributors may be
# used to endorse or promote products derived from this software without 
# specific prior written permission. 
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

#
# Makefile for libaccess.a
#
BUILD_ROOT=../../..
USE_NSPR=1
USE_CLIENTLIBS=1
USE_LDAPSDK=1
USE_XERCESC=1
USE_JNI=1

# disable position independent code to improve execution speed
NO_KPIC=1

include ${BUILD_ROOT}/make/defines.mk

MODULE=LibAccess
ifndef BUILD_JAVA
#DIRS+=ipv6utest
endif

include accessobjs.mk

all::

EXPORT_LIBRARIES=libaccess
AR_TARGET=libaccess

LOCAL_INC=-I.. -I../public -I../../support
LOCAL_INC+=-I$(JAVA_INCLUDE_DIR)
LOCAL_INC+=$(JNI_INCLUDES)

LOCAL_DEF+= -DACL_LIB_INTERNAL
LOCAL_DEF+= -DSERVER_BUILD
LOCAL_DEF+= -DPEER_SNMP
LOCAL_DEF+= -DBUILD_DLL
LOCAL_DEF+= -DNSPR20

AR_OBJS=$(ACCESSOBJS)

# this should always be last!
include ${BUILD_ROOT}/make/rules.mk


#
# acl.tab.c acl.tab.h and acl.yy.c should not be generated by the build,
# they are checked in and should be pulled from the tree by
# default.  The following rules are provided in case the grammar or
# lexer needs changes.
#

#
# Right now it's best to run yacc on a Solaris machine because the
# /usr/lib/yaccpar makes the NT compiler happier.  It should work on
# other UNIX systems -- but that's what is checked in and tested.
#
yacc:
	$(YACC) -d acltext.y
	sed -f yy-sed y.tab.h > acl.tab.h
	sed -f yy-sed y.tab.c > acl.tab.cpp
	rm y.tab.h y.tab.c

#
# Flex generates a case insenitive lexer.  It also provides mechanisms
# that allow NSPR to replace it's standard IO routines.  The standard UNIX
# lex wants to use some stupid library!  One would think that lex could
# generate all the code it needs just like FLEX.
# 
flex: 
	$(FLEX) -i aclscan.l
	sed -f yy-sed lex.yy.c > acl.yy.cpp
	rm lex.yy.c
