#
# @(#)Makefile 1.56 84/04/04 SMI
#

CFILESUSER= toolmerge.c suntools.c icontool.c patches.c coretool.c \
	gfxtool.c shelltool.c clocktool.c panetool.c toolplaces.c \
	get_view_surface.c \
	jumpdemo.c spheresdemo.c bouncedemo.c framedemo.c optiontool.c \
	canvasinput.c canvasflash.c mousetool.c
CFILESNODISTRIBUTE= perfmon.c lockscreen.c adjacentscreens.c

CFILESALL=$(CFILESUSER) $(CFILESNODISTRIBUTE) 
HDRSALL= patches.h
SRCSALL=$(CFILESALL) $(HDRSALL) Makefile

AWK=	/bin/awk
TOUCH=	touch -c
DESTDIR=
DESTMACH=
PROFILE=
CFLAGS=	-O
LDFLAGS=
CTAGS=	/usr/ucb/ctags -w
LIBS=	-lsuntool -lsunwindow -lpixrect

#CMDS=suntools gfxtool shelltool clocktool panetool lockscreen toolplaces \
	icontool bouncedemo jumpdemo spheresdemo framedemo perfmon \
	coretool canvasinput canvasflash mousetool
CMDS=suntools icontool lockscreen toolplaces adjacentscreens \
	panetool optiontool canvasinput canvasflash mousetool \
	bouncedemo jumpdemo spheresdemo framedemo perfmon
# Note: add line to install when change CMDS

all: $(CMDS)

suntools: shelltool.o suntools.o clocktool.o gfxtool.o coretool.o \
	    toolmerge.o
	cc ${LDFLAGS} -o suntools shelltool.o suntools.o clocktool.o gfxtool.o \
		coretool.o toolmerge.o ${LIBS}

icontool: icontool.o patches.o
	cc ${LDFLAGS} -o icontool icontool.o patches.o ${LIBS}

mousetool: mousetool.o
	cc ${LDFLAGS} -o mousetool mousetool.o ${LIBS}

optiontool: optiontool.o
	cc ${LDFLAGS} -o optiontool optiontool.o ${LIBS}

panetool: panetool.o
	cc ${LDFLAGS} -o panetool panetool.o ${LIBS}

#gfxtool: gfxtool.o
#	cc ${LDFLAGS} -o gfxtool gfxmerge.o gfxtool.o ${LIBS}

#shelltool: shelltool.o
#	cc ${LDFLAGS} -o shelltool shelltool.o ${LIBS}

#clocktool: clocktool.o
#	cc ${LDFLAGS} -o clocktool clocktool.o ${LIBS}

#coretool: coretool.o
#	cc ${LDFLAGS} -o coretool coretool.o ${LIBS}

toolplaces: toolplaces.o
	cc ${LDFLAGS} -o toolplaces toolplaces.o ${LIBS}

lockscreen: lockscreen.o
	cc ${LDFLAGS} -o lockscreen lockscreen.o ${LIBS}

adjacentscreens: adjacentscreens.o
	cc ${LDFLAGS} -o adjacentscreens adjacentscreens.o ${LIBS}

bouncedemo: bouncedemo.o
	cc ${LDFLAGS} -o bouncedemo bouncedemo.o ${LIBS}

jumpdemo: jumpdemo.o
	cc ${LDFLAGS} -o jumpdemo jumpdemo.o ${LIBS}

framedemo: framedemo.o
	cc ${LDFLAGS} -o framedemo framedemo.o ${LIBS}

canvasflash: canvasflash.o
	cc ${LDFLAGS} -o canvasflash canvasflash.o ${LIBS}

canvasinput: canvasinput.o
	cc ${LDFLAGS} -o canvasinput canvasinput.o ${LIBS}

spheresdemo: spheresdemo.o
	cc ${LDFLAGS} -o spheresdemo spheresdemo.o ${LIBS}

perfmon: perfmon.o
	cc ${LDFLAGS} -o perfmon perfmon.o ${LIBS}

install: $(CMDS)
# rm panetool because used to be symbolic link to suntools
	rm -f ${DESTDIR}/usr/suntool/panetool
	-for i in '' /fixedwidthfonts /globeframes /src; do \
		mkdir ${DESTDIR}/usr/suntool$$i && \
		chown bin ${DESTDIR}/usr/suntool$$i && \
		chmod 755 ${DESTDIR}/usr/suntool$$i; \
	done
# do not strip when install so can get reasonable bug reports with stack traces
	install -c suntools ${DESTDIR}/usr/suntool
	-for i in clocktool gfxtool shelltool coretool; do \
		ln -s suntools ${DESTDIR}/usr/suntool/$$i; done
	install -c -s toolplaces ${DESTDIR}/usr/suntool
	install -c -s lockscreen ${DESTDIR}/usr/suntool
	install -c -s adjacentscreens ${DESTDIR}/usr/suntool
	install -c -s optiontool ${DESTDIR}/usr/suntool
	install -c -s panetool ${DESTDIR}/usr/suntool
	install -c -s icontool ${DESTDIR}/usr/suntool
	install -c -s mousetool ${DESTDIR}/usr/suntool
	install -c -s bouncedemo ${DESTDIR}/usr/suntool
	install -c -s spheresdemo ${DESTDIR}/usr/suntool
	install -c -s jumpdemo ${DESTDIR}/usr/suntool
	install -c -s framedemo ${DESTDIR}/usr/suntool
	install -c -s perfmon ${DESTDIR}/usr/suntool
	install -c -s canvasflash ${DESTDIR}/usr/suntool
	install -c -s canvasinput ${DESTDIR}/usr/suntool
	cp fixedwidthfonts/[a-z]* ${DESTDIR}/usr/suntool/fixedwidthfonts
	cp globeframes/* ${DESTDIR}/usr/suntool/globeframes
	cp $(CFILESUSER) $(HDRSALL) Makefile shelltool.icon gfxtool.icon \
		clocktool.icon core_eye.icon icontool.icon clockhands.c \
		${DESTDIR}/usr/suntool/src

tar:
	echo You will want to have an empty directory that you are taring to!
	tar fc - . | rsh ${DESTMACH} \
		"cd /usr/src/sun/suntool;tar xpBf -"

clean:
	rm -f *.o core $(CMDS) 

cleanCMDS:
	rm -f $(CMDS) 

$(SRCSALL):
	sccs get $@;

srcsget: $(SRCSALL)

tags:	$(CFILESALL)
	${CTAGS} $(CFILESALL);

print:	$(SRCSALL)
	lpr -p -Pimagen $(SRCSALL)

lint:
	lint $(CFLAGS) $(CFILESALL) /usr/lib/lint/llib_lpixrect.ln \
		/usr/lib/lint/llib_lsunwindow.ln \
		/usr/lib/lint/llib_lsuntool.ln

# Commands remove from depend
#	grep -v '<' |
#	      sed 's,../[a-z]*/,,' | 
# Commands added to depend
#       sed 's/:[^<]*<\([^>]*\)>.*/: \/usr\/include\/\1/' | 
depend:
	grep '^#include' ${CFILESALL} | \
     	      sed 's/:[^<]*<\([^>]*\)>.*/: \/usr\/include\/\1/' | \
	      sed 's/:[^"]*"\([^"]*\)".*/: \1/' | \
	      sed 's/\.c/.o/' | \
	${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 '$$r makedep' >>eddep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	rm -f Makefile.bak
	cp Makefile Makefile.bak
	ed - Makefile < eddep
	rm eddep makedep
	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	echo '# see make depend above' >> Makefile

# DO NOT DELETE THIS LINE -- make depend uses it

suntools.o: /usr/include/suntool/tool_hs.h /usr/include/sys/ioctl.h
suntools.o: /usr/include/sys/dir.h /usr/include/sys/file.h
suntools.o: /usr/include/sys/wait.h /usr/include/sys/resource.h
suntools.o: /usr/include/errno.h /usr/include/stdio.h /usr/include/pwd.h
suntools.o: /usr/include/suntool/menu.h /usr/include/suntool/wmgr.h
icontool.o: /usr/include/suntool/tool_hs.h /usr/include/sys/stat.h
icontool.o: /usr/include/stdio.h /usr/include/errno.h patches.h
icontool.o: /usr/include/suntool/msgsw.h /usr/include/suntool/optionsw.h
icontool.o: icontool.icon
patches.o: patches.h
coretool.o: /usr/include/sys/types.h /usr/include/signal.h
coretool.o: /usr/include/pixrect/pixrect.h /usr/include/pixrect/pixfont.h
coretool.o: /usr/include/pixrect/pr_util.h /usr/include/pixrect/memvar.h
coretool.o: /usr/include/sunwindow/rect.h /usr/include/sunwindow/rectlist.h
coretool.o: /usr/include/sunwindow/cms.h /usr/include/sunwindow/pixwin.h
coretool.o: /usr/include/sunwindow/win_screen.h /usr/include/suntool/icon.h
coretool.o: /usr/include/suntool/tool.h /usr/include/suntool/emptysw.h
coretool.o: core_eye.icon
gfxtool.o: /usr/include/suntool/tool_hs.h /usr/include/suntool/emptysw.h
gfxtool.o: /usr/include/suntool/ttysw.h /usr/include/stdio.h gfxtool.icon
shelltool.o: /usr/include/suntool/tool_hs.h /usr/include/suntool/ttysw.h
shelltool.o: /usr/include/stdio.h shelltool.icon
clocktool.o: /usr/include/sys/time.h /usr/include/sys/types.h
clocktool.o: /usr/include/errno.h /usr/include/stdio.h /usr/include/signal.h
clocktool.o: /usr/include/pixrect/pixrect.h /usr/include/pixrect/pixfont.h
clocktool.o: /usr/include/pixrect/pr_util.h /usr/include/pixrect/memvar.h
clocktool.o: /usr/include/sunwindow/rect.h /usr/include/sunwindow/rectlist.h
clocktool.o: /usr/include/sunwindow/win_input.h /usr/include/sunwindow/pixwin.h
clocktool.o: /usr/include/sunwindow/win_struct.h
clocktool.o: /usr/include/sunwindow/win_environ.h /usr/include/suntool/icon.h
clocktool.o: /usr/include/suntool/tool.h /usr/include/suntool/msgsw.h
clocktool.o: clockhands.c clocktool.icon
panetool.o: /usr/include/sys/types.h /usr/include/sys/time.h
panetool.o: /usr/include/signal.h /usr/include/pixrect/pixrect.h
panetool.o: /usr/include/pixrect/pixfont.h /usr/include/sunwindow/rect.h
panetool.o: /usr/include/sunwindow/rectlist.h /usr/include/sunwindow/pixwin.h
panetool.o: /usr/include/sunwindow/win_input.h
panetool.o: /usr/include/sunwindow/win_struct.h /usr/include/suntool/icon.h
panetool.o: /usr/include/suntool/tool.h /usr/include/suntool/msgsw.h
panetool.o: /usr/include/suntool/menu.h
toolplaces.o: /usr/include/sys/types.h /usr/include/sys/file.h
toolplaces.o: /usr/include/sys/time.h /usr/include/sunwindow/rect.h
toolplaces.o: /usr/include/sunwindow/rectlist.h /usr/include/sunwindow/cms.h
toolplaces.o: /usr/include/sunwindow/win_struct.h
toolplaces.o: /usr/include/sunwindow/win_input.h
toolplaces.o: /usr/include/sunwindow/win_screen.h
toolplaces.o: /usr/include/sunwindow/win_ioctl.h /usr/include/suntool/wmgr.h
get_view_surface.o: /usr/include/sys/file.h /usr/include/sys/ioctl.h
get_view_surface.o: /usr/include/sun/fbio.h /usr/include/stdio.h
get_view_surface.o: /usr/include/sunwindow/window_hs.h /usr/include/usercore.h
jumpdemo.o: /usr/include/sys/types.h /usr/include/pixrect/pixrect.h
jumpdemo.o: /usr/include/sunwindow/rect.h /usr/include/sunwindow/rectlist.h
jumpdemo.o: /usr/include/sunwindow/cms.h /usr/include/sunwindow/pixwin.h
jumpdemo.o: /usr/include/sunwindow/cms_rgb.h /usr/include/suntool/gfxsw.h
spheresdemo.o: /usr/include/sys/types.h /usr/include/pixrect/pixrect.h
spheresdemo.o: /usr/include/pixrect/pr_util.h /usr/include/pixrect/memvar.h
spheresdemo.o: /usr/include/sunwindow/rect.h /usr/include/sunwindow/rectlist.h
spheresdemo.o: /usr/include/sunwindow/cms.h
spheresdemo.o: /usr/include/sunwindow/cms_rainbow.h
spheresdemo.o: /usr/include/sunwindow/pixwin.h /usr/include/suntool/gfxsw.h
bouncedemo.o: /usr/include/sys/types.h /usr/include/pixrect/pixrect.h
bouncedemo.o: /usr/include/sunwindow/rect.h /usr/include/sunwindow/rectlist.h
bouncedemo.o: /usr/include/sunwindow/pixwin.h /usr/include/suntool/gfxsw.h
framedemo.o: /usr/include/stdio.h /usr/include/sys/types.h
framedemo.o: /usr/include/sys/file.h /usr/include/sys/time.h
framedemo.o: /usr/include/pixrect/pixrect.h /usr/include/pixrect/pr_util.h
framedemo.o: /usr/include/pixrect/bw1var.h /usr/include/pixrect/memvar.h
framedemo.o: /usr/include/sunwindow/rect.h /usr/include/sunwindow/rectlist.h
framedemo.o: /usr/include/sunwindow/pixwin.h /usr/include/sunwindow/win_input.h
framedemo.o: /usr/include/sunwindow/win_struct.h /usr/include/suntool/gfxsw.h
optiontool.o: /usr/include/stdio.h /usr/include/suntool/tool_hs.h
optiontool.o: /usr/include/suntool/optionsw.h
canvasinput.o: /usr/include/stdio.h /usr/include/suntool/gfx_hs.h
canvasinput.o: /usr/include/suntool/menu.h
canvasflash.o: /usr/include/stdio.h /usr/include/suntool/gfx_hs.h
mousetool.o: /usr/include/stdio.h /usr/include/suntool/tool_hs.h
mousetool.o: /usr/include/suntool/optionsw.h /usr/include/suntool/msgsw.h
perfmon.o: /usr/include/stdio.h /usr/include/sys/param.h /usr/include/sys/vm.h
perfmon.o: /usr/include/sys/dk.h /usr/include/nlist.h /usr/include/sys/buf.h
perfmon.o: /usr/include/sundev/mbvar.h /usr/include/sys/socket.h
perfmon.o: /usr/include/net/if.h /usr/include/netinet/in.h
perfmon.o: /usr/include/sys/file.h /usr/include/sys/time.h
perfmon.o: /usr/include/pixrect/pixrect.h /usr/include/pixrect/pixfont.h
perfmon.o: /usr/include/pixrect/pr_util.h /usr/include/pixrect/memvar.h
perfmon.o: /usr/include/sunwindow/rect.h /usr/include/sunwindow/rectlist.h
perfmon.o: /usr/include/sunwindow/pixwin.h /usr/include/sunwindow/win_input.h
perfmon.o: /usr/include/sunwindow/win_struct.h /usr/include/suntool/gfxsw.h
lockscreen.o: /usr/include/pwd.h /usr/include/sys/file.h
lockscreen.o: /usr/include/suntool/tool_hs.h /usr/include/suntool/optionsw.h
lockscreen.o: /usr/include/suntool/msgsw.h lockscreen.icon
adjacentscreens.o: /usr/include/sys/types.h /usr/include/sys/file.h
adjacentscreens.o: /usr/include/errno.h /usr/include/stdio.h
adjacentscreens.o: /usr/include/sunwindow/rect.h
adjacentscreens.o: /usr/include/sunwindow/win_screen.h
adjacentscreens.o: /usr/include/sunwindow/win_struct.h
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
