# NSS-multidomain: NSS module for multidomain authentification
# Copyright (C) 2001, 2002 LibertySurf Telecom, Antoniu-George Savu
# 
# 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.

include Config.mk

EXTRA_CFLAGS = $(debug)
CLIBS = -ldb

all: libnss_multidomain.so.2 nss-test make-db

multidomain-auth.so: multidomain-auth.c
	$(CC) $(CFLAGS) -c -D_PATH_DB=\"$(dbdir)\" -D_DEFAULT_SHELL=\"$(shell)\" -D_DB_TYPE=DB_$(dbtype) -D_MIN_UID=$(minuid) -D_MIN_GID=$(mingid) -Wall -Wwrite-strings $(EXTRA_CFLAGS) -fPIC $< -o $@

libnss_multidomain.so.2 : multidomain-auth.so
	$(CC) $(CFLAGS) -shared -Wl,-soname,$@ $< -o $@ $(CLIBS)

install: $(LIBDIR) $(LIBDIR)/libnss_multidomain.so.2

make-db: make-db.c
	$(CC) $(CFLAGS) -Wall $< -o $@ $(CLIBS)

$(LIBDIR):
	mkdir -p $@

$(LIBDIR)/libnss_multidomain.so.2: libnss_multidomain.so.2
	install -p -o $(OWN) -g $(GRP) $< $@

distclean clean: 
	$(RM) libnss_multidomain.so.2 *.so *~ nss-test make-db Config.mk
