# @(#)Makefile.in
#
# Copyright 1997 - 2025  David A. Bagley, bagleyd AT verizon.net
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of the author not be
# used in advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
#
# This program is distributed in the hope that it will be "useful",
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# xdino Makefile.in for configure (UNIX X11 support)

NAME = dino
WIDGET = Dino
WIDGET2 = $(WIDGET)2d
WIDGET3 = $(WIDGET)3d
C=.c
O=.o
#O=.obj
#O=.@OBJEXT@
E=
#E=.exe
#E=@EXEEXT@
P=x
A=X
R=$(P)
V=
GROUP = xpuzzles
PROG = $(R)$(NAME)
VER = $(V)$(NAME)

# this tells GNU make not to export variables into the environment
# But other makes do not understand its significance, so it must
# not be the first target in the file. So it is here, before
# any variables are created, but after the default target
.NOEXPORT :

SHELL = /bin/sh
MANNUM = 6

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

#prefix = @prefix@
# Gnome and KDE Desktop installation
prefix = /usr
#prefix = ${HOME}
exec_prefix = @exec_prefix@

bindir = @bindir@
gamesdir = /usr/games
mandir = @mandir@/man$(MANNUM)
#xapploaddir = @APPDEFAULTS@
#xapploaddir = @libdir@/X11/app-defaults
# Gnome and KDE Desktop installation
xapploaddir = /etc/X11/app-defaults
#xapploaddir = @libdir@/app-defaults
#xapploaddir = $(HOME)
datarootdir = @datarootdir@
datadir = @datadir@
readdir = $(datadir)/games/$(GROUP)
scoredir = /var/games/$(GROUP)
logdir = /usr/tmp

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
M = @XM_PREFIX@

DESTDIR =

#CC = cc -g
#CC = acc -g
#CC = gcc -g -Wall -ansi -pedantic
#CC = gcc -g -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wmissing-prototypes -Wstrict-prototypes -pedantic -Wno-long-long
#CC = gcc -std=c89
#CC = gcc -g -Wall
#CC = g++ -g -Wall
#CC = CC -g
CC = @CC@

LINT = lint
#LINT = alint

INDENT = indent

MORE = more
#MORE = less

PRINT = lpr
#PRINT = enscript -2r

SCOREPATH = $(scoredir)
SCOREFILE = $(NAME).scores
LOGPATH = $(logdir)
LOGFILE = $(NAME).log

LN_S = @LN_S@
RM = rm -f
RM_S = $(RM)
ECHO = echo

#BLN_S = set file/enter=[]
#RM = delete/noconfirm/nolog
#RM_S = set file/remove/nolog
#ECHO = write sys$output

# wav files in win32 may sound better
W = @SOUNDEXT@

# Assumes a directory of /var/games/$(GROUP) if -DSCOREPATH not set.
# Assumes a directory of /usr/tmp if -DLOGPATH not set.
DEFINES = \
-DSOUNDPATH=\"$(readdir)\" -DSOUNDEXT=\"$(W)\" \
-DMOVESOUND=\"move\" \
-DSCOREPATH=\"$(SCOREPATH)\" -DSCOREFILE=\"$(SCOREFILE)\" \
-DLOGPATH=\"$(LOGPATH)\" -DLOGFILE=\"$(LOGFILE)\" -DUSE_SPIN
DEFS = @DEFS@ $(DEFINES)
# -DTRY_SOLVE -DFIND -DUSE_POPUP
# -DSRAND=srand48 -DLRAND=lrand48 -DMAXRAND=2147483648.0
# -DSRAND=srandom -DLRAND=random -DMAXRAND=2147483648.0
# -DSRAND=srand -DLRAND=rand -DMAXRAND=32768.0
# -DHAVE_USLEEP
# -DHAVE_NANOSLEEP
# -DCONSTPIXMAPS
XWIDGETINC = @XWIDGETINC@ -I$(top_srcdir) -I.
CFLAGS = @CFLAGS@
#CFLAGS = -O
#CFLAGS = -g
XWIDGETLDFLAGS = @XWIDGETLDFLAGS@
XLIBS = @XLIBS@
XWIDGETLIBS = @XWIDGETLIBS@

COREHDRS = $(WIDGET)P.h \
$(WIDGET).h \
xwin.h \
file.h \
timer.h \
rngs.h \
sound.h \
version.h \
xgui.h \
pixmaps/check.xbm \
pixmaps/box.xbm \
pixmaps/up.xbm \
pixmaps/down.xbm \
pixmaps/64x64/$(NAME).xbm \
pixmaps/16x16/$(NAME).xpm \
pixmaps/22x22/$(NAME).xpm \
pixmaps/24x24/$(NAME).xpm \
pixmaps/32x32/$(NAME).xpm \
pixmaps/48x48/$(NAME).xpm \
pixmaps/64x64/$(NAME).xpm
HDRS = $(COREHDRS) \
$(WIDGET2)P.h \
$(WIDGET2).h \
$(WIDGET3)P.h \
$(WIDGET3).h \
$(WIDGET)GLP.h \
$(WIDGET)GL.h

COREOBJS = $(WIDGET)$(O) \
$(WIDGET)S$(O) \
$(WIDGET)U$(O) \
$(WIDGET)F$(O) \
$(WIDGET2)$(O) \
$(WIDGET3)$(O) \
$(WIDGET)GL$(O)
UTILOBJS = xwin$(O) \
file$(O) \
timer$(O) \
rngs$(O) \
sound$(O) \
xgui$(O)
OBJS = $(UTILOBJS) \
$(COREOBJS) \
$(P)$(NAME)$(O)

CORESRCS = $(WIDGET)$(C) \
$(WIDGET)S$(C) \
$(WIDGET)U$(C) \
$(WIDGET)F$(C) \
$(WIDGET2)$(C) \
$(WIDGET3)$(C) \
$(WIDGET)GL$(C)
UTILSRCS = xwin$(C) \
file$(C) \
timer$(C) \
rngs$(C) \
sound$(C) \
xgui$(C)
SRCS = $(UTILSRCS) \
$(CORESRCS) \
$(P)$(NAME)$(C)

all : $(PROG)

constpixmaps :
	@ $(ECHO) "USE with -DCONSTPIXMAPS"
	cd pixmaps;\
	for pix in */*.xpm; do\
		dir=`dirname $$pix`;\
		mkdir -p ../icons/$$dir;\
		sed 's/static char/static const char/' $$pix > ../icons/$$pix;\
	done;\
	cd ..

$(PROG) : $(OBJS)
	$(CC) -o $@ $(OBJS) $(XWIDGETLDFLAGS) $(XWIDGETLIBS)
	@ $(ECHO) "$@ BUILD COMPLETE"
	@ $(ECHO) ""
	@ $(ECHO) "To install: \"make install\" for Gnome/KDE Desktop install"
	@ $(ECHO) "\t\"make install-bin-all\" for System V style install"
	@ $(ECHO) "\t\"make install-games-all\" for BSD style install"

$(WIDGET)$(O) : $(WIDGET)$(C) $(COREHDRS)
$(WIDGET)S$(O) : $(WIDGET)S$(C) $(WIDGET)P.h $(WIDGET).h rngs.h
$(WIDGET)U$(O) : $(WIDGET)U$(C) $(WIDGET)P.h $(WIDGET).h
$(WIDGET)F$(O) : $(WIDGET)F$(C) $(WIDGET)P.h $(WIDGET).h rngs.h
(WIDGET2)$(O) : $(WIDGET2)$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET2)P.h $(WIDGET2).h xwin.h
$(WIDGET3)$(O) : $(WIDGET3)$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET3)P.h $(WIDGET3).h xwin.h
$(WIDGET)GL$(O) : $(WIDGET)GL$(C) $(WIDGET)P.h $(WIDGET).h $(WIDGET)GLP.h $(WIDGET)GL.h
xwin$(O) : xwin$(C) xwin.h
file$(O) : file$(C) file.h
timer$(O) : timer$(C) timer.h
rngs$(O) : rngs$(C) rngs.h
sound$(O) : sound$(C) sound.h file.h
xgui$(O) : xgui$(C) xgui.h
$(P)$(NAME)$(O) : $(P)$(NAME)$(C) $(WIDGET).h \
xwin.h file.h version.h xgui.h

# Gnome and KDE Desktop installation
install : install-games install-xappload install-png install-sounds install-man-gz install-desktop install-scores

uninstall : uninstall-scores uninstall-xappload uninstall-png uninstall-sounds uninstall-man-gz uninstall-desktop uninstall-games

#System V style installation (will not be able to modify scores as user)
install-bin-all : install-bin install-xappload install-man install-sounds install-scores

uninstall-bin-all : uninstall-scores uninstall-xappload uninstall-man uninstall-sounds uninstall-bin

#BSD style installation
install-games-all : install-games install-xappload install-man install-sounds install-scores

uninstall-games-all : uninstall-scores uninstall-xappload uninstall-man uninstall-sounds uninstall-games

install-games : $(PROG)$(E) @NOPLAY@play.sh
	$(srcdir)/mkinstalldirs $(DESTDIR)$(gamesdir)
	$(INSTALL_PROGRAM) $(PROG)$(E) $(DESTDIR)$(gamesdir)/$(R)$(M)$(NAME)$(E)
	chown -f games:games $(DESTDIR)$(gamesdir)/$(R)$(M)$(NAME)$(E) || true
	@NOPLAY@$(INSTALL_SCRIPT) play.sh $(DESTDIR)$(gamesdir)/play.sh

uninstall-games :
	$(RM) $(DESTDIR)$(gamesdir)/$(R)$(M)$(NAME)$(E)
	rmdir $(DESTDIR)$(gamesdir) 2> /dev/null || true
	@ $(ECHO) "Has multiple uses, remove manually (used for playing sounds):"
	#@NOPLAY@$(RM) $(DESTDIR)$(gamesdir)/play.sh

install-bin : $(PROG)$(E) @NOPLAY@play.sh
	$(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
	$(INSTALL_PROGRAM) $(PROG)$(E) $(DESTDIR)$(bindir)/$(R)$(M)$(NAME)$(E)
	@NOPLAY@$(INSTALL_SCRIPT) play.sh $(DESTDIR)$(bindir)/play.sh

uninstall-bin :
	$(RM) $(DESTDIR)$(bindir)/$(R)$(M)$(NAME)$(E)
	rmdir $(DESTDIR)$(bindir) 2> /dev/null || true
	@ $(ECHO) "Has multiple uses, remove manually (used for playing sounds):"
	#@NOPLAY@$(RM) $(DESTDIR)$(bindir)/play.sh

install-xappload :
	$(srcdir)/mkinstalldirs $(DESTDIR)$(xapploaddir)
	sed 's;.READ_PATH;$(DESTDIR)$(readdir);g' $(srcdir)/$(A)$(WIDGET).ad > $(A)$(WIDGET).ad.tmp
	$(INSTALL_DATA) $(A)$(WIDGET).ad.tmp $(DESTDIR)$(xapploaddir)/$(A)$(WIDGET)
	rm -f $(A)$(WIDGET).ad.tmp

uninstall-xappload :
	$(RM) $(DESTDIR)$(xapploaddir)/$(A)$(WIDGET)
	rmdir $(DESTDIR)$(xapploaddir) 2> /dev/null || true

install-man-gz :
	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
	$(INSTALL_DATA) $(srcdir)/$(PROG).man $(DESTDIR)$(mandir)/$(PROG).$(MANNUM)
	gzip -f $(DESTDIR)$(mandir)/$(PROG).$(MANNUM)

uninstall-man-gz :
	$(RM) $(DESTDIR)$(mandir)/$(PROG).$(MANNUM).gz
	rmdir $(DESTDIR)$(mandir) 2> /dev/null || true

install-man :
	$(srcdir)/mkinstalldirs $(DESTDIR)$(mandir)
	$(INSTALL_DATA) $(srcdir)/$(PROG).man $(DESTDIR)$(mandir)/$(PROG).$(MANNUM)

uninstall-man :
	$(RM) $(DESTDIR)$(mandir)/$(PROG).$(MANNUM)
	rmdir $(DESTDIR)$(mandir) 2> /dev/null || true

install-png :
	for i in 16x16 22x22 24x24 32x32 48x48; do\
		$(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)/icons/hicolor/$$i/apps;\
		$(INSTALL_DATA) pixmaps/$$i/$(NAME).png $(DESTDIR)$(datadir)/icons/hicolor/$$i/apps/$(NAME).png;\
	done

uninstall-png :
	for i in 16x16 22x22 24x24 32x32 48x48; do\
		$(RM) $(DESTDIR)$(datadir)/icons/hicolor/$$i/apps/$(NAME).png;\
		rmdir $(DESTDIR)$(datadir)/icons/hicolor/$$i/apps 2> /dev/null || true;\
		rmdir $(DESTDIR)$(datadir)/icons/hicolor/$$i 2> /dev/null || true;\
	done
	rmdir $(DESTDIR)$(datadir)/icons/hicolor 2> /dev/null || true
	rmdir $(DESTDIR)$(datadir)/icons 2> /dev/null || true
	rmdir $(DESTDIR)$(datadir) 2> /dev/null || true

install-desktop :
	mkdir -p $(DESTDIR)$(datadir)/applications
	echo "[Desktop Entry]" > $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Name=${WIDGET}" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Version=`grep VERSION version.h | cut -f2 -d\\\"`" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "GenericName=${WIDGET} (Dinosaur) puzzle" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Comment=puzzle" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Exec=${PROG}" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Icon=$(datarootdir)/icons/hicolor/48x48/apps/$(NAME).png" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Terminal=false" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Type=Application" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "X-MutlipleArgs=false" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Categories=Games;Puzzle" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "StartupNotify=true" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	echo "Keywords=Games;Puzzle" >> $(DESTDIR)$(datadir)/applications/$(PROG).desktop

uninstall-desktop :
	$(RM) $(DESTDIR)$(datadir)/applications/$(PROG).desktop
	rmdir $(DESTDIR)$(datadir)/applications 2> /dev/null || true
	rmdir $(DESTDIR)$(datadir) 2> /dev/null || true

install-sounds :
	$(srcdir)/mkinstalldirs $(DESTDIR)$(readdir)
	$(INSTALL_DATA) $(srcdir)@WAVDIR@/move$(W) $(DESTDIR)$(readdir)/move$(W)

uninstall-sounds :
	@ $(ECHO) "sound files could be used by other $(GROUP)"
	if ! test -d $(scoredir); then\
		$(RM) $(DESTDIR)$(readdir)/*$(W);\
	fi
	rmdir $(DESTDIR)$(readdir) 2> /dev/null || true

install-scores :
	$(srcdir)/mkinstalldirs $(DESTDIR)$(scoredir)
	chmod 775 $(scoredir)
	$(INSTALL_PROGRAM) $(srcdir)/$(NAME).scores $(DESTDIR)$(scoredir)/$(NAME).scores
	chown -f games:games $(DESTDIR)$(scoredir) 2> /dev/null || true
	chown -f games:games $(DESTDIR)$(scoredir)/$(NAME).scores 2> /dev/null || true
	chmod 664 $(DESTDIR)$(scoredir)/$(NAME).scores

uninstall-scores :
	$(RM) $(DESTDIR)$(scoredir)/$(NAME).scores
	rmdir $(DESTDIR)$(scoredir) 2> /dev/null || true

#CDE
install-xpm :
	$(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)/dt/appconfig/icons/C
	$(INSTALL_DATA) pixmaps/16x16/$(NAME).xpm $(DESTDIR)$(datadir)/dt/appconfig/icons/C/$(NAME).t.pm
	$(INSTALL_DATA) pixmaps/24x24/$(NAME).xpm $(DESTDIR)$(datadir)/dt/appconfig/icons/C/$(NAME).s.pm
	$(INSTALL_DATA) pixmaps/32x32/$(NAME).xpm $(DESTDIR)$(datadir)/dt/appconfig/icons/C/$(NAME).m.pm
	$(INSTALL_DATA) pixmaps/48x48/$(NAME).xpm $(DESTDIR)$(datadir)/dt/appconfig/icons/C/$(NAME).l.pm

uninstall-xpm :
	for i in t s m l; do\
		$(RM) $(DESTDIR)$(datadir)/dt/appconfig/icons/C/$(NAME).$$i.pm;\
	done
	rmdir $(DESTDIR)$(datadir)/dt/appconfig/icons/C 2> /dev/null || true
	rmdir $(DESTDIR)$(datadir)/dt/appconfig/icons 2> /dev/null || true
	rmdir $(DESTDIR)$(datadir)/dt/appconfig 2> /dev/null || true
	rmdir $(DESTDIR)$(datadir)/dt 2> /dev/null || true
	rmdir $(DESTDIR)$(datadir) 2> /dev/null || true

#CDE HOME directory
install-xpm-home :
	$(srcdir)/mkinstalldirs $(HOME)/.dt/icons/C
	$(INSTALL_DATA) pixmaps/16x16/$(NAME).xpm $(HOME)/.dt/icons/C/$(NAME).t.pm
	$(INSTALL_DATA) pixmaps/24x24/$(NAME).xpm $(HOME)/.dt/icons/C/$(NAME).s.pm
	$(INSTALL_DATA) pixmaps/32x32/$(NAME).xpm $(HOME)/.dt/icons/C/$(NAME).m.pm
	$(INSTALL_DATA) pixmaps/48x48/$(NAME).xpm $(HOME)/.dt/icons/C/$(NAME).l.pm

uninstall-xpm-home :
	for i in t s m l; do\
		$(RM) $(HOME)/.dt/icons/C/$(NAME).$$i.pm;\
	done
	rmdir $(HOME)/.dt/icons/C 2> /dev/null || true
	rmdir $(HOME)/.dt/icons 2> /dev/null || true
	rmdir $(HOME)/.dt 2> /dev/null || true

SUFFIXES : $(C) $(O) $(E)

$(C)$(O) :
	$(CC) -c $(CPPFLAGS) $(DEFS) $(XWIDGETINC) $(CFLAGS) $<

Makefile : Makefile.in config.status
	$(SHELL) config.status
config.status : configure
	$(SHELL) config.status --recheck
#configure : configure.ac
# enable this rule if you want autoconf to be executed automatically when
# configure.ac is changed. This is commented out, since patching might give
# configure.ac a newer timestamp than configure and not everybody has autoconf
#	cd $(srcdir); autoconf

run :
	./$(PROG)
#	./$(PROG) -mode 2 -practice -orient -delay 0

run.help :
	./$(PROG) -help || true

run.scores :
	./$(PROG) -scores

run.version :
	./$(PROG) -version

lldb :
	lldb ./$(PROG)

gdb :
	gdb ./$(PROG)

dbx :
	dbx ./$(PROG)

valgrind :
	valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all \
./$(PROG)

clean :
	$(RM) *.o *.exe* core *~ *% *.bak make.log MakeOut Makefile.dep \
$(PROG) $(PROG).errs $(PROG).1.html $(PROG)._man *.tmp
	test -d win32 && (cd win32 ; make -f Makefile clean) || true

distclean : clean
	$(RM) config.cache config.log
	$(RM)r autom4te.cache
	$(RM)r icons
	$(RM) make.com
	test -d win32 && (cd win32 ; make -f Makefile distclean) || true

clean.all : distclean
	$(RM) Makefile config.status*

autoconf :
	autoconf
	$(RM)r autom4te.cache

PACKAGE=$(VER)/$(WIDGET).h $(VER)/$(WIDGET)P.h \
$(VER)/$(WIDGET2).h $(VER)/$(WIDGET2)P.h \
$(VER)/$(WIDGET3).h $(VER)/$(WIDGET3)P.h \
$(VER)/$(WIDGET)GL.h $(VER)/$(WIDGET)GLP.h \
$(VER)/xwin.h $(VER)/file.h $(VER)/timer.h $(VER)/rngs.h \
$(VER)/sound.h $(VER)/version.h $(VER)/xgui.h \
$(VER)/pixmaps/mouse-l.xbm $(VER)/pixmaps/mouse-r.xbm \
$(VER)/pixmaps/*x*/$(NAME).* $(VER)/pixmaps/check.xbm \
$(VER)/pixmaps/box.xbm $(VER)/pixmaps/up.xbm $(VER)/pixmaps/down.xbm \
$(VER)/move.au $(VER)/play.sh \
$(VER)/$(WIDGET)$(C) $(VER)/$(WIDGET)S$(C) $(VER)/$(WIDGET)U$(C) \
$(VER)/$(WIDGET2)$(C) $(VER)/$(WIDGET3)$(C) $(VER)/$(WIDGET)GL$(C) \
$(VER)/$(WIDGET)F$(C) $(VER)/$(P)$(NAME)$(C) \
$(VER)/xwin$(C) $(VER)/file$(C) $(VER)/timer$(C) $(VER)/rngs$(C) \
$(VER)/sound$(C) $(VER)/xgui$(C) \
$(VER)/Imakefile $(VER)/$(PROG).man $(VER)/$(PROG).html \
$(VER)/$(A)$(WIDGET).ad $(VER)/$(NAME).scores \
$(VER)/configure $(VER)/Makefile.in $(VER)/configure.ac \
$(VER)/config.guess $(VER)/config.sub $(VER)/config.cygport \
$(VER)/install-sh $(VER)/mkinstalldirs \
$(VER)/AUTHORS $(VER)/ChangeLog $(VER)/COPYING $(VER)/NEWS \
$(VER)/INSTALL $(VER)/README $(VER)/TODO \
$(VER)/vms/README.vms $(VER)/vms/$(PROG).hlp \
$(VER)/vms/make.com $(VER)/vms/mmov.com $(VER)/vms/descrip.mms \
$(VER)/vms/vms_amd.c $(VER)/vms/vms_amd.h $(VER)/vms/vms_mmov.c \
$(VER)/win32/Makefile $(VER)/win32/w$(NAME).rc \
$(VER)/win32/move.wav \
$(VER)/win32/w$(NAME).ini $(VER)/win32/$(NAME).ico

zip :
	cd .. ; zip $(VER) $(PACKAGE)

pkzip :
	cd .. ; pkzip $(VER) $(PACKAGE)

tar :
	cd .. ; tar cvf $(VER).tar $(PACKAGE)

compress :
	cd .. ; tar cvf - $(PACKAGE) | compress > $(VER).tar.Z

gzip :
	cd .. ; tar cvf - $(PACKAGE) | gzip > $(VER).tar.gz

bzip2 :
	cd .. ; tar cvf - $(PACKAGE) | bzip2 > $(VER).tar.bz2

xz :
	cd .. ; tar cvf - $(PACKAGE) | xz > $(VER).tar.xz

dist : xz

dist.man : $(PROG).html vms/$(PROG).hlp

$(PROG).html : $(PROG).man
	if man2html $< > $(PROG).tmp; then\
		mv $(PROG).tmp $@;\
	else\
		rm -f $(PROG).tmp;\
	fi

# found man2hlp.sh in lynx source
vms/$(PROG).hlp : $(PROG).man
	man2hlp.sh $< > $(PROG).tmp 2> $(PROG)2.tmp
	if grep error $(PROG)2.tmp > /dev/null; then\
		cat $(PROG)2.tmp;\
		rm -f $(PROG).tmp $(PROG)2.tmp;\
	else\
		rm -f $(PROG)2.tmp;\
		mv $(PROG).tmp $@;\
	fi

html : $(PROG).html

hlp : vms/$(PROG).hlp

man :
	nroff -c -man $(PROG).man | $(MORE)

print:
	$(PRINT) $(HDRS) $(SRCS)

read :
	$(MORE) README

AUTOMAKE=/usr/share/automake-1.16

automake :
	cp -p ${AUTOMAKE}/config.guess .;\
	cp -p ${AUTOMAKE}/config.sub .;\
	cp -p ${AUTOMAKE}/install-sh .;\
	cp -p ${AUTOMAKE}/mkinstalldirs .

antic :
	antic *.h *.c */*/*.xpm */*/*.xbm */*.xbm */*.c */*.h

cppcheck :
	cppcheck -f -q *.c */*.c

lint :
	$(LINT) -ax -DLINT $(DEFS) $(XWIDGETINC) $(SRCS) $(XWIDGETLIBS)

indent :
	$(INDENT) $(HDRS) $(SRCS)

ICONS=\
	16x16/$(NAME).png\
	22x22/$(NAME).png\
	24x24/$(NAME).png\
	32x32/$(NAME).png\
	48x48/$(NAME).png

PNGS=$(ICONS:%.png=pixmaps/%.png)

pixmaps/%.png : pixmaps/%.xpm
	if grep None $< > /dev/null; then\
		sed -e 's/None/White/' $< | xpmtoppm |\
		pnmtopng -transparent 1,1,1 > $@;\
	else\
		xpmtoppm $< | pnmtopng > $@;\
	fi;\
	pngcrush -ow -rem allb -reduce $@

pixmap : $(PNGS)
