#! /bin/make -f
#
#	uw makefile (4.3BSD)
#
# INCDIR names the directory where the header files are located.
#
# OBJECTS names all of the object files required for the server.
#

INCDIR	=	../h

OBJECTS	=	uw_clk.o uw_env.o uw_fd.o uw_ipc.o uw_main.o uw_opt.o \
		uw_pcl.o uw_tty.o uw_utmp.o uw_win.o openpty.o

SOURCES	=	`echo $(OBJECTS) | sed -e 's/\\.o/\\.c/g'`

DEFINES	=	`cat ../DEFINES`

CFLAGS	=	$(DEFINES) -I$(INCDIR) -O
LFLAGS	=	-s -object

uw:		$(OBJECTS)
	$(CC) $(LFLAGS) -o uw $(OBJECTS) $(LIBS)

lint:
	lint -hbx -I$(INCDIR) $(DEFINES) $(SOURCES)

tags:
	ctags $(SOURCES)

depend: 
	$(CC) -M -I$(INCDIR) $(DEFINES) $(SOURCES) | \
	sed -e ':loop' \
	    -e 's/\.\.\/[^ /]*\/\.\./../' \
	    -e 't loop' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' >> makedep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ex - Makefile < eddep
	rm eddep makedep

clean:
	rm *.o

# DO NOT DELETE THIS LINE (or the following blank line) -- make depend uses it

uw_clk.o : uw_clk.c /usr/include/sys/types.h /usr/include/sys/time.h \
  /usr/include/time.h /usr/include/stddef.h /usr/include/sys/signal.h \
  /usr/include/machine/signal.h /usr/include/sys/resource.h ../h/uw_param.h \
  ../h/uw_clk.h 
uw_env.o : uw_env.c 
uw_fd.o : uw_fd.c /usr/include/sys/types.h ../h/uw_param.h ../h/uw_fd.h 
uw_ipc.o : uw_ipc.c /usr/include/sys/types.h /usr/include/sys/file.h \
  /usr/include/sys/fcntl.h /usr/include/sys/stat.h /usr/include/sys/socket.h \
  /usr/include/sys/un.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h \
  /usr/include/sys/ttydev.h /usr/include/sys/uio.h /usr/include/netinet/in.h \
  /usr/include/strings.h /usr/include/string.h /usr/include/stddef.h \
  /usr/include/netdb.h /usr/include/errno.h /usr/include/sys/errno.h \
  /usr/include/stdio.h /usr/include/stdarg.h ../h/uw_param.h ../h/uw_err.h \
  ../h/uw_opt.h ../h/uw_win.h ../h/uw_fd.h ../h/uw_pcl.h ../h/uw_ipc.h 
uw_main.o : uw_main.c /usr/include/sys/types.h /usr/include/sys/file.h \
  /usr/include/sys/fcntl.h /usr/include/sys/wait.h \
  /usr/include/sys/resource.h /usr/include/sys/time.h /usr/include/time.h \
  /usr/include/stddef.h /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h \
  /usr/include/sys/ttydev.h /usr/include/pwd.h /usr/include/signal.h \
  /usr/include/sys/signal.h /usr/include/machine/signal.h \
  /usr/include/errno.h /usr/include/sys/errno.h /usr/include/strings.h \
  /usr/include/string.h /usr/include/stdio.h /usr/include/stdarg.h \
  ../h/uw_param.h ../h/uw_clk.h ../h/uw_opt.h ../h/uw_win.h ../h/uw_fd.h \
  ../h/uw_pcl.h ../h/uw_ipc.h ../h/openpty.h 
uw_opt.o : uw_opt.c /usr/include/sys/types.h ../h/uw_param.h ../h/uw_opt.h 
uw_pcl.o : uw_pcl.c /usr/include/sys/types.h /usr/include/sys/ioctl.h \
  /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h /usr/include/errno.h \
  /usr/include/sys/errno.h /usr/include/stddef.h ../h/uw_param.h \
  ../h/uw_clk.h ../h/uw_opt.h ../h/uw_win.h ../h/uw_pcl.h ../h/openpty.h 
uw_tty.o : uw_tty.c /usr/include/sys/types.h /usr/include/sys/file.h \
  /usr/include/sys/fcntl.h /usr/include/sys/ioctl.h \
  /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h \
  /usr/include/sys/stat.h ../h/uw_param.h ../h/uw_win.h ../h/uw_opt.h 
uw_utmp.o : uw_utmp.c 
uw_win.o : uw_win.c /usr/include/sys/types.h /usr/include/sys/file.h \
  /usr/include/sys/fcntl.h /usr/include/sys/ioctl.h \
  /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h /usr/include/signal.h \
  /usr/include/sys/signal.h /usr/include/machine/signal.h \
  /usr/include/strings.h /usr/include/string.h /usr/include/stddef.h \
  /usr/include/stdio.h /usr/include/stdarg.h ../h/openpty.h ../h/uw_param.h \
  ../h/uw_opt.h ../h/uw_win.h ../h/uw_fd.h 
openpty.o : openpty.c /usr/include/sys/types.h /usr/include/sys/dir.h \
  /usr/include/fcntl.h /usr/include/strings.h /usr/include/string.h \
  /usr/include/stddef.h ../h/openpty.h 
