# $USAGI: Makefile,v 1.8 2004/04/24 15:07:18 nakam Exp $

# Copyright (C)2003 USAGI/WIDE Project
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

CFLAGS = $(CCOPTS) $(DEF) $(INC)

ifeq ($(USE_LIBXF),)
NL_OBJS = mip6nl.o
NL_LIB_STFILE = libmip6nl.a

MH_OBJS = mip6mh.o
MH_LIB_STFILE = libmip6mh.a

TUN_OBJS = mip6tunnel.o
TUN_LIB_STFILE = libmip6tunnel.a

else
XFNL_OBJS = libxfnl.o
XFNL_LIB_STFILE = libxfnl.a

UTIL_OBJS = strutil.o
UTIL_LIB_STFILE = libutil.a
endif

OBJS = $(NL_OBJS) $(MH_OBJS) $(TUN_OBJS) $(XFNL_OBJS) $(UTIL_OBJS)
LIB_STFILE = $(NL_LIB_STFILE) $(MH_LIB_STFILE) $(TUN_LIB_STFILE) \
	$(XFNL_LIB_STFILE) $(UTIL_LIB_STFILE)

all: $(LIB_STFILE)

$(NL_LIB_STFILE): $(NL_OBJS)
	$(AR) -r $@ $(NL_OBJS)
$(MH_LIB_STFILE): $(MH_OBJS)
	$(AR) -r $@ $(MH_OBJS)
$(TUN_LIB_STFILE): $(TUN_OBJS)
	$(AR) -r $@ $(TUN_OBJS)
$(XFNL_LIB_STFILE): $(XFNL_OBJS)
	$(AR) -r $@ $(XFNL_OBJS)
$(UTIL_LIB_STFILE): $(UTIL_OBJS)
	$(AR) -r $@ $(UTIL_OBJS)

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

distclean: clean
	rm -f *~

$(NL_OBJS): ../include/mip6nl.h
$(MH_OBJS): ../include/mip6nl.h
$(TUN_OBJS): mip6tunnel.c
$(XFNL_OBJS): ../include/libxfnl.h
$(UTIL_OBJS): ../include/libutil.h

../include/libutil.h: ../include/strutil.h
