# Project    : ipv6calc/ipv6calc
# File       : Makefile[.in]
# Version    : $Id: Makefile.in,v 1.27 2010/05/20 14:49:38 peter Exp $
# Copyright  : 2002-2007 by Peter Bieringer <pb (at) bieringer.de>
#
# Information:
#  Makefile for ipv6calc
#

prefix		= @prefix@
exec_prefix	= @exec_prefix@
bindir		= @bindir@

# Compiler and Linker Options
DEFAULT_CFLAGS ?= -O2 -Wall -g

INCLUDES= @GETOPT_INCLUDE@ @IP2LOCATION_INCLUDE@ @GEOIP_INCLUDE@ -I../ -I../lib/

LIBS = @IP2LOCATION_LIB@ @GEOIP_LIB@

GETOBJS = @LIBOBJS@ ../md5/md5.o

CC	= @CC@

OBJS	= ipv6calc.o showinfo.o

# splint
SPLINT_OPT_OUTSIDE = -warnposix -nullassign -uniondef -compdef -usedef -formatconst -exportlocal
#SPLINT_OPT_OUTSIDE = -uniondef +matchanyintegral --nullassign +ignoresigns -compdef -usedef -modobserver -formatconst -warnposix -exportlocal
SPLINT_TODO_LATER = -unrecog  -retvalint


all:		ipv6calc

.c.o:
		$(CC) $(DEFAULT_CFLAGS) $(CFLAGS) $(INCLUDES) -c $<

$(OBJS):	ipv6calc.h showinfo.h ../config.h ../lib/ipv6calcoptions.h

libipv6calc.a:	
		cd ../ && ${MAKE} lib-make

ipv6calc:	$(OBJS) libipv6calc.a
		$(CC) $(LDFLAGS) -o ipv6calc $(OBJS) $(GETOBJS) -lipv6calc -L../lib/ $(LIBS)

static:		ipv6calc
		$(CC) $(LDFLAGS) -o ipv6calc-static $(OBJS) $(GETOBJS) -lipv6calc -L../lib/ -static $(LIBS)

distclean:
		${MAKE} clean

autoclean:
		${MAKE} distclean

clean:
		rm -f ipv6calc ipv6calc-static *.o

test:
		${MAKE}
		./test_ipv6calc.sh || exit 1

splint:		
		splint *.c ../lib/*.c -I.. -I../lib $(SPLINT_OPT_OUTSIDE) $(SPLINT_TODO_LATER)

install:	ipv6calc
		mkdir -p $(DESTDIR)$(bindir)
		install -m 755 ipv6calc $(DESTDIR)$(bindir)
