#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
# 
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
# 
# The Original Code is a trivial PKCS#11 test program.
# 
# The Initial Developer of the Original Code is Netscape
# Communications Corp.  Portions created by Netscape are 
# Copyright (C) 2000.  All Rights Reserved.
# 
# Contributor(s): 
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU General Public License Version 2 or later (the
# "GPL"), in which case the provisions of the GPL are applicable 
# instead of those above.  If you wish to allow use of your 
# version of this file only under the terms of the GPL and not to
# allow others to use your version of this file under the MPL,
# indicate your decision by deleting the provisions above and
# replace them with the notice and other provisions required by
# the GPL.  If you do not delete the provisions above, a recipient
# may use your version of this file under either the MPL or the
# GPL.
#

MAKEFILE_IN_CVS_ID = "@(#) $RCSfile: Makefile.in,v $ $Revision: 1.1 $ $Date: 2000/05/08 23:19:43 $ $Name: NSS_3_1_1_RTM $"

SHELL = /bin/sh
.SUFFIXES:
.SUFFIXES: .c .o .h .in .a .so

srcdir = @srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
includedir = @includedir@
bindir = @bindir@
@SET_MAKE@
INSTALL = @INSTALL@
RANLIB = @RANLIB@
AR = @AR@
CC = @CC@
LD = @LD@
RM = @RM@
TAR = @TAR@

CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

INSTALL_PROGRAM = $(INSTALL) -m 0500

all:: program

# Standard Netscape/Mozilla targets:
# import import_xp export private_export libs program install all clobber 
# clobber_all release release_xp alltags

# Standard GNU targets:
# all install uninstall install-strip clean distclean mostlyclean 
# maintainer-clean TAGS info dvi dist check installcheck installdirs

# === The actual targets and the real commands that make them ===
program:: trivial

trivial: trivial.c config.h Makefile
	$(CC) -I. -I${srcdir} $(CFLAGS) $(CPPFLAGS) $< -o $@ $(LDFLAGS) $(LIBS)

# Now, various standard targets, some that do stuff, some that are no-ops

import::

export:: install

private_export::

program::

clobber:: clean

clobber_all:: maintainer-clean

alltags:: TAGS

RESULTS =						\
    $(DESTDIR)$(bindir)/trivial	\
    $(NULL)

install:: $(RESULTS)

$(DESTDIR)$(bindir)/trivial: trivial
	$(INSTALL_PROGRAM) trivial $(DESTDIR)$(bindir)/trivial

# "rm -f" with no arguments bites on some platforms.
# There should be an autoconf check and maybe a more 
# general $(FORCEDREMOVE) command

uninstall::
	$(RM) -f $(RESULTS)

install-strip::
	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s ' install

clean::
	$(RM) -f *~ core trivial.o trivial

distclean:: clean
	$(RM) -f Makefile config.cache config.h config.log config.status stamp-h stamp-h.in

mostlyclean:: clean

maintainer-clean:: distclean
	$(RM) -f TAGS trivial*.tar.gz

TAGS::

DISTFILES =		 \
    .cvsignore	 \
    README.txt	 \
    Makefile.in	 \
	acconfig.h	 \
	config.h.in	 \
	configure	 \
	configure.in \
	install-sh	 \
	trivial.c	 \
	$(NULL)

dist:: trivial.tar.gz

# There must be an easier and more portable way of doing this..
trivial.tar.gz: $(DISTFILES)
	echo $(DISTFILES) | tr ' ' '\n' | sed "s^.*^`( cd ${srcdir}; pwd ) | xargs basename`/&^" | xargs tar czf $@ -C ${srcdir}/..

# other "standard" but irrelevant targets
info::

dvi::

check::

installcheck::

installdirs::

# Include dependancies


# autoheader might not change config.h.in, so touch a stamp file
${srcdir}/config.h.in: stamp-h.in
${srcdir}/stamp-h.in: configure.in acconfig.h
	cd ${srcdir} && autoheader
	echo timestamp > ${srcdir}/stamp-h.in

# Remake the configuration
${srcdir}/configure: configure.in
	cd ${srcdir} && autoconf

config.h: stamp-h
stamp-h: config.h.in config.status
	./config.status

Makefile: Makefile.in config.status
	./config.status

config.status: configure
	./config.status --recheck
