# Project    : ipv6calc/ipv6logconv
# File       : ipv6logconv/Makefile[.in]
# Version    : $Id: 62b74ee978aa49619c716634ff9ae8e1205b1d13 $
# Copyright  : 2002-2022 by Peter Bieringer <pb (at) bieringer.de>
#
# Information:
#  Makefile for ipv6logconv
#

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

# Compiler and Linker Options
#  -D__EXTENSIONS__ is for Solaris & strtok_r
DEFAULT_CFLAGS ?= -O2 -Wall -g @CFLAGS_EXTRA@
CFLAGS += -D__EXTENSIONS__

LDFLAGS += @LDFLAGS@

INCLUDES= @MD5_INCLUDE@ @GETOPT_INCLUDE@ @IP2LOCATION_INCLUDE_L1@ @MMDB_INCLUDE_L1@ -I../ -I../lib/ -I../databases/lib/

LIBS = @IPV6CALC_LIB@ @IP2LOCATION_LIB_L1@ @MMDB_LIB_L1@ @DYNLOAD_LIB@

GETOBJS = @LIBOBJS@

CC	= @CC@

LDFLAGS_EXTRA = @LDFLAGS_EXTRA@
LDFLAGS_EXTRA_STATIC = @LDFLAGS_EXTRA_STATIC@

OBJS	= ipv6logconv.o ipv6logconvhelp.o

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

all:		ipv6logconv

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

$(OBJS):	ipv6logconvoptions.h ipv6logconvhelp.h ipv6logconv.h

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

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

ipv6logconv:	$(OBJS) libipv6calc libipv6calc_db_wrapper
		$(CC) -o ipv6logconv $(OBJS) $(GETOBJS) $(LDFLAGS) $(LIBS) $(LDFLAGS_EXTRA) -lm

static:		ipv6logconv
		$(CC) -o ipv6logconv-static $(OBJS) $(GETOBJS) $(LDFLAGS) $(LIBS) $(LDFLAGS_EXTRA_STATIC) -lm -static

distclean:
		${MAKE} clean

autoclean:
		${MAKE} distclean

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

test:		ipv6logconv
		LD_LIBRARY_PATH=@LD_LIBRARY_PATH@ ./test_ipv6logconv.sh

test-minimal:
		${MAKE} test

test-ldlibpath:	ipv6logconv
		LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):@LD_LIBRARY_PATH_BASIC@ ./test_ipv6logconv.sh

codecheck:
		${MAKE} splint
		
splint:
		splint *.c ../lib/*.c -I.. -I../lib $(SPLINT_OPT_OUTSIDE) $(SPLINT_TODO_LATER)

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