##########################################################################
# (C) Copyright 2001 The Free Standards Group Inc
# (C) Copyright 1991 X/Open Company Limited
#
# All rights reserved.  No part of this source code may be reproduced,
# stored in a retrieval system, or transmitted, in any form or by any
# means, electronic, mechanical, photocopying, recording or otherwise,
# except as stated in the end-user licence agreement, without the prior
# permission of the copyright owners.
#
# X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
# the UK and other countries.
#
#
#	PROJECT:	LSB
#	PRODUCT:	LSB.usersgroups/commands/passwd
#	AUTHOR:		Chris Yeoh, The Free Standards Group Inc
#	DATE CREATED:	3 July 2001
#	TARGETS:	T.passwd
##########################################################################

CC =	cc
RM =		rm -f
LINT =	lint
LINT1 =		/usr/lib/lint1
# This is a working lint in the top level testset directory
PRINTER =	lpr
PRINTFLAGS =	
TET_EXECUTE =	../../../../TESTROOT

TET_ROOT =	../../../../..
VSXDIR =	../../../../SRC
SYSINC =	$(VSXDIR)/SYSINC
SYSLIBS =

VSXINC =	$(VSXDIR)/INC
VSXLIB =	$(VSXDIR)/LIB
VSXBIN =	$(VSXDIR)/BIN
LIBVPORT =	$(VSXLIB)/vport.a
CHMOG =	$(VSXBIN)/chmog
GENLIB =	$(VSXLIB)/genlib.a

# What is installed:

INSTOWN0 =	root
INSTGRP0 =	vsxg0
INSTMODE0 =	4755
INSTOWN =	vsx0
INSTGRP =	vsxg0
INSTMODE =	755
INSTDIR =	$(TET_EXECUTE)/tset/LSB.usersgroups/commands/passwd

# Local (to this product only) includes, libraries, etc:

LOCALINC =
LOCALLIB =	

# product-wide libraries for ld(1):

LIBS =

DBUG =	
COPTS =	
SDBFLAG =	
DEFINES =	

# INCS, as seen from obj directory
INCS =		-I$(TETINC) -I$(VSXINC) -I$(SYSINC)
CFLOCAL =	-D_GNU_SOURCE
CFLAGS =	$(CFLOCAL) $(INCS) $(DEFINES) $(DBUG) $(COPTS) $(SDBFLAG)
LDFLAGS =	

CFILES0 = 	root_helper.c
OFILES0	= 	root_helper.o

CFILES1 = 	cpt.c
OFILES1 =	cpt.o

CFILES2 = 	uberpass.c
OFILES2 =	uberpass.o

CFILES =	$(CFILES0) $(CFILES1) $(CFILES2)
OFILES =	$(OFILES0) $(OFILES1) $(OFILES2)
IFILES =	
LFILES =	

LINTFLAGS =	$(INCS) $(DEFINES) -n
LINTLIBS =	-lvsx -lvlib -lgen -ltset -lvport
LINTDRV =	$(VSXDIR)/common/tet_startup/startup.c

# Targets: ---------------------------------------------------------

all:		T.passwd cpt root_helper root_funcs uberpass

T.passwd:	passwd-tc.sh

root_helper:	$(OFILES0) 
		$(CC) $(LDFLAGS) -o $@ $(OFILES0)
		@echo "	$@ made"

cpt:	$(OFILES1) 
		$(CC) $(LDFLAGS) -o $@ $(OFILES1)
		@echo "	$@ made"

uberpass:	$(OFILES2) 
		$(CC) $(LDFLAGS) -o $@ $(OFILES2)
		@echo "	$@ made"

passwd-tc.sh:	$(TET_EXECUTE)/LIB/usersgroups_funcs.sh $(TET_EXECUTE)/LIB/shfuncs.sh

$(LIBS):
	-@echo "Warning: cannot continue making: $@ needs to be installed"
		@false

INSTALL:		$(INSTDIR)/T.passwd $(INSTDIR)/cpt $(INSTDIR)/root_helper $(INSTDIR)/root_funcs $(INSTDIR)/uberpass

$(INSTDIR)/T.passwd:	passwd-tc.sh
		$(CHMOG) $(INSTMODE) $(INSTOWN) $(INSTGRP0) -c $? $@
		@echo " $? installed in $@"

$(INSTDIR)/root_funcs:	root_funcs.sh
		$(CHMOG) $(INSTMODE) $(INSTOWN) $(INSTGRP) -c $? $@
		@echo " $? installed in $@"

$(INSTDIR)/cpt:	cpt
		$(CHMOG) $(INSTMODE) $(INSTOWN) $(INSTGRP) -m $? $@
		@echo " $? installed in $@"

$(INSTDIR)/root_helper:	root_helper
		$(CHMOG) $(INSTMODE0) $(INSTOWN0) $(INSTGRP) -m $? $@
		@echo " $? installed in $@"

$(INSTDIR)/uberpass:	uberpass
		$(CHMOG) $(INSTMODE0) $(INSTOWN0) $(INSTGRP) -m $? $@
		@echo " $? installed in $@"


LINTLIB:

LINT:
		$(LINT) $(LINTFLAGS) $(CFILES) $(LINTDRV) $(LTCM) $(LINTLIBS)

FORCE:		CLOBBER all

PRINT:
		@$(PRINTER) $(PRINTFLAGS) Makefile $(IFILES) $(CFILES)

CLEAN:
		$(RM) $(OFILES)

CLOBBER:	CLEAN
		$(RM) root_helpr $(INSTDIR)/root_helper cpt $(INSTDIR)/cpt  \
		$(INSTDIR)/root_funcs $(INSTDIR)/T.passwd uberpass \
		$(INSTDIR)/uberpass

depend:
	CFLAGS="$(CFLAGS)" CC="$(CC)" $(VSXBIN)/mkdep $(CFILES)

# DO NOT DELETE THIS LINE -- make depend uses it
# DEPENDENCIES MUST END AT END OF FILE
misc.o:	  \
	../../../../SRC/INC/dbug.h  \
	../../../../SRC/INC/report.h  \
	../../../../SRC/INC/std.h  \
	../../../../SRC/INC/sysdep.h  \
	../../../../SRC/SYSINC/limits.h  \
	../../../../SRC/SYSINC/string.h  \
	../../../../SRC/SYSINC/sys/types.h 
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
