The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
#
#   Copyright (C) 1997, 1998
#   	Free Software Foundation, Inc.
#
#   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, 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, 675 Mass Ave, Cambridge, MA 02139, USA. 
#
CC = @CC@
LDFLAGS = @LDFLAGS@
LDLIBS =  @LIBS@ -L. -luri
CFLAGS = -I. @PIC_CFLAGS@ @DEFS@ @CPPFLAGS@ @CFLAGS@
prefix=	@prefix@
exec_prefix=@exec_prefix@
BINDIR = @bindir@
LIBDIR = @libdir@
INCLUDEDIR = @includedir@
MANDIR = @mandir@

include uri_schemes.mk

LIB_OBJ = \
	liburi.a(uri.o) \
	liburi.a(uri_schemes.o) \
	liburi.a(uri_util.o) \
	liburi.a(uri_parse.o) \
	liburi.a(uri_scheme_generic.o) \
	liburi.a(mpath.o) \
	liburi.a(strlower.o) \
	liburi.a(salloc.o) \
	liburi.a(split.o) \
	liburi.a(getopt.o) \
	liburi.a(getopt1.o) \
	$(URI_SCHEMES)

LIB = liburi.a

all: $(LIB)

install: all
	if [ ! -d $(LIBDIR) ] ; then mkdir -p $(LIBDIR) ; fi
	if [ ! -d $(INCLUDEDIR) ] ; then mkdir -p $(INCLUDEDIR) ; fi
	if [ ! -d $(BINDIR) ] ; then mkdir -p $(BINDIR) ; fi
	if [ ! -d $(MANDIR)/man3 ] ; then mkdir -p $(MANDIR)/man3 ; fi
	cp -p $(LIB) $(LIBDIR)
	cp -p uri.h $(INCLUDEDIR)
	cp -p uri.3 $(MANDIR)/man3/

clean:
	rm -f $(LIB) *.o t/*.out t_uri gen_schemes 

realclean: clean
	rm -f Makefile config.cache config.h config.log config.status *~ core
	rm -f .pure *pure* t/*~ uri_test core gen_escapes

t_uri: $(LIB)

test: t_uri 
	#
	# If tests not successfull some diff output will show
	#
	./uri_test

#
# The minimal hash table found for fields is 13 entries. I didn't
# find a convinient way to use it, however.
# gperf -n -k1,2,3 -j1 <<!
# scheme
# host
# port
# path
# params
# query
# frag
# user
# passwd
# !
#
uri_schemes_hash.c: SCHEMES 
	gperf -k2-4 -c -G -W uri_scheme_list -H uri_scheme_hash -N uri_scheme_exists < SCHEMES > uri_schemes_hash.c
	$(MAKE) gen_schemes
	gen_schemes `ls uri_scheme_*.c | sed -e 's/uri_scheme_\(.*\).c/\1/'`

uri_scheme_generic.o: uri_escapes_generic.h

uri_escapes_generic.h uri_escapes_file.h uri_escapes_news.h:: uri_escapes.txt
	gen_escapes

$(LIB): $(LIB_OBJ)

.PHONY: test