#
#  makefile for Utilities Library
#
LIBSC = alloca.o any.o cat.o clean.o dname.o fatal.o \
	fdfopen.o imatch.o index.o lockit.o patoi.o rename.o \
       	repeat.o repl.o satoi.o setsig.o sname.o strend.o \
	substr.o trnslat.o userexit.o xcreat.o xlink.o xmsg.o \
	xopen.o xpipe.o xunlink.o zero.o zeropad.o

CC = cc
CFLAGS = -O
I = /usr/include

.c.o:
	$(CC) -c $(CFLAGS) $<
	ld -r -x $*.o
	mv a.out $*.o

.s.o:
	as -o $*.o $<
	ld -r -x $*.o
	mv a.out $*.o

.c.c:
	get s.$<

.s.s:
	get s.$<

#------
# libsc.a: Create libsc.a in local directory and
#          move it to /usr/src/cmd/sccs/hdr
#------
libsc.a:        $LIBSC
	rm -f libsc.a
	ar r libsc.a $LIBSC
	mv libsc.a ../cmd/sccs/hdr/libsc.a
	ranlib ../cmd/sccs/hdr/libsc.a

#------
# clean: Remove all .o files and do SCCS cleanup.
#------
clean:
	-rm -f *.o
	-sc *


#------
# Dependencies for individual .o files and .c files.
#------

alloca.o:       alloca.s        
any.o:          any.c           
cat.o:          cat.c           
clean.o:        clean.c         
dname.o:        dname.c         macros.h $I/sys/types.h $I/sys/stat.h 
fatal.o:        fatal.c         macros.h $I/sys/types.h $I/sys/stat.h \
				fatal.h 
fdfopen.o:      fdfopen.c       $I/stdio.h macros.h $I/sys/types.h \
				$I/sys/stat.h 
imatch.o:       imatch.c        
index.o:        index.c         
lockit.o:       lockit.c        macros.h $I/sys/types.h $I/sys/stat.h \
				$I/errno.h 
patoi.o:        patoi.c         
rename.o:       rename.c        $I/errno.h 
repeat.o:       repeat.c        
repl.o:         repl.c          
satoi.o:        satoi.c         macros.h $I/sys/types.h $I/sys/stat.h 
setsig.o:       setsig.c        $I/signal.h macros.h $I/sys/types.h \
				$I/sys/stat.h 
sname.o:        sname.c         
strend.o:       strend.c        
substr.o:       substr.c        
trnslat.o:      trnslat.c       
userexit.o:     userexit.c      
xcreat.o:       xcreat.c        macros.h $I/sys/types.h $I/sys/stat.h 
xlink.o:        xlink.c         $I/errno.h 
xmsg.o:         xmsg.c          $I/errno.h macros.h $I/sys/types.h \
				$I/sys/stat.h 
xopen.o:        xopen.c         $I/errno.h 
xpipe.o:        xpipe.c         
xunlink.o:      xunlink.c       
zero.o:         zero.c          
zeropad.o:      zeropad.c       
