# @(#)Makefile.in
#
# Copyright 1997 - 2024  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.

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

wIDGET = barrel
WIDGET = Barrel
GROUP = xpuzzles
P=x
A=X
R=$(P)
V=
PROG = $(R)$(wIDGET)
VER = $(V)$(wIDGET)

# 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 = $(wIDGET).scores
LOGPATH = $(logdir)
LOGFILE = $(wIDGET).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)\" \
-DBUMPSOUND=\"bump\" -DMOVESOUND=\"move\" \
-DSCOREPATH=\"$(SCOREPATH)\" -DSCOREFILE=\"$(SCOREFILE)\" \
-DLOGPATH=\"$(LOGPATH)\" -DLOGFILE=\"$(LOGFILE)\" -DUSE_SPIN
DEFS = @DEFS@ $(DEFINES)
# -DPICTURE=\"$(readdir)/mandrill.xbm\"
# -DPICTURE=\"$(readdir)/mandrill.xpm\"
# -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@

N=
C=.c
#C++
#C=.cc
#C=.cpp

O=.o
#O=.@OBJEXT@
S=$(N) $(N)
E=@EXEEXT@

#VMS
#O=.obj
#S=,
#E=.exe

# please define
# C as the C source code extension
# O as the object extension
# S as the separator for object code
# E as the executable extension

HDRS = $(WIDGET)P.h $(WIDGET).h \
xwin.h file.h timer.h rngs.h \
sound.h picture.h version.h xgui.h \
pixmaps/check.xbm pixmaps/box.xbm pixmaps/up.xbm pixmaps/down.xbm \
pixmaps/grain_lr.xbm pixmaps/grain_tb.xbm \
pixmaps/64x64/$(wIDGET).xbm \
pixmaps/16x16/$(wIDGET).xpm pixmaps/22x22/$(wIDGET).xpm \
pixmaps/24x24/$(wIDGET).xpm pixmaps/32x32/$(wIDGET).xpm \
pixmaps/48x48/$(wIDGET).xpm pixmaps/64x64/$(wIDGET).xpm

COREOBJS = $(WIDGET)$(O)$(S)$(WIDGET)S$(O)$(S)$(WIDGET)U$(O)
UTILOBJS = xwin$(O)$(S)file$(O)$(S)timer$(O)$(S)rngs$(O)$(S)sound$(O)$(S)\
xgui$(O)
OBJS = $(UTILOBJS)$(S)picture$(O)$(S)\
$(COREOBJS)$(S)$(P)$(wIDGET)$(O)

CORESRCS = $(WIDGET)$(C) $(WIDGET)S$(C) $(WIDGET)U$(C)
UTILSRCS = xwin$(C) file$(C) timer$(C) rngs$(C) sound$(C) \
xgui$(C)
SRCS = $(UTILSRCS) picture$(C) \
$(CORESRCS) $(P)$(wIDGET)$(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) $(HDRS)
$(WIDGET)S$(O) : $(WIDGET)S$(C) $(WIDGET)P.h $(WIDGET).h rngs.h
$(WIDGET)U$(O) : $(WIDGET)U$(C) $(WIDGET)P.h $(WIDGET).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
picture$(O) : picture$(C) picture.h file.h
xgui$(O) : xgui$(C) xgui.h
$(P)$(wIDGET)$(O) : $(P)$(wIDGET)$(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-image install-scores

uninstall : uninstall-scores uninstall-xappload uninstall-png uninstall-sounds uninstall-man-gz uninstall-desktop uninstall-image 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-image install-scores

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

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

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

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

uninstall-games :
	$(RM) $(DESTDIR)$(gamesdir)/$(R)$(M)$(wIDGET)$(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)$(wIDGET)$(E)
	@NOPLAY@$(INSTALL_SCRIPT) play.sh $(DESTDIR)$(bindir)/play.sh

uninstall-bin :
	$(RM) $(DESTDIR)$(bindir)/$(R)$(M)$(wIDGET)$(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/$(wIDGET).png $(DESTDIR)$(datadir)/icons/hicolor/$$i/apps/$(wIDGET).png;\
	done

uninstall-png :
	for i in 16x16 22x22 24x24 32x32 48x48; do\
		$(RM) $(DESTDIR)$(datadir)/icons/hicolor/$$i/apps/$(wIDGET).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} 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/$(wIDGET).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@/bump$(W) $(DESTDIR)$(readdir)/bump$(W)
	$(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-image :
	$(srcdir)/mkinstalldirs $(DESTDIR)$(readdir)
	$(INSTALL_DATA) $(srcdir)/mandrill.xpm $(DESTDIR)$(readdir)/mandrill.xpm
	$(INSTALL_DATA) $(srcdir)/mandrill.xbm $(DESTDIR)$(readdir)/mandrill.xbm

uninstall-image :
	@ $(ECHO) "mandrill bitmaps could be used by other $(GROUP)"
	if ! test -d $(scoredir); then\
		$(RM) $(DESTDIR)$(readdir)/mandrill.xpm;\
		$(RM) $(DESTDIR)$(readdir)/mandrill.xbm;\
	fi
	rmdir $(DESTDIR)$(readdir) 2> /dev/null || true

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

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

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

uninstall-xpm :
	for i in t s m l; do\
		$(RM) $(DESTDIR)$(datadir)/dt/appconfig/icons/C/$(wIDGET).$$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/$(wIDGET).xpm $(HOME)/.dt/icons/C/$(wIDGET).t.pm
	$(INSTALL_DATA) pixmaps/24x24/$(wIDGET).xpm $(HOME)/.dt/icons/C/$(wIDGET).s.pm
	$(INSTALL_DATA) pixmaps/32x32/$(wIDGET).xpm $(HOME)/.dt/icons/C/$(wIDGET).m.pm
	$(INSTALL_DATA) pixmaps/48x48/$(wIDGET).xpm $(HOME)/.dt/icons/C/$(wIDGET).l.pm

uninstall-xpm-home :
	for i in t s m l; do\
		$(RM) $(HOME)/.dt/icons/C/$(wIDGET).$$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)

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

run.picture :
	./$(PROG) -picture pixmaps/mandrill.xpm

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
	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)/xwin.h $(VER)/file.h $(VER)/timer.h $(VER)/rngs.h \
$(VER)/sound.h $(VER)/picture.h $(VER)/version.h $(VER)/xgui.h \
$(VER)/pixmaps/mouse-l.xbm $(VER)/pixmaps/mouse-r.xbm \
$(VER)/pixmaps/*x*/$(wIDGET).* $(VER)/pixmaps/check.xbm \
$(VER)/pixmaps/box.xbm $(VER)/pixmaps/up.xbm $(VER)/pixmaps/down.xbm \
$(VER)/pixmaps/grain_lr.xbm $(VER)/pixmaps/grain_tb.xbm \
$(VER)/mandrill.xbm $(VER)/mandrill.xpm \
$(VER)/bump.au $(VER)/move.au $(VER)/play.sh \
$(VER)/$(WIDGET)$(C) $(VER)/$(WIDGET)S$(C) $(VER)/$(WIDGET)U$(C) \
$(VER)/$(P)$(wIDGET)$(C) \
$(VER)/xwin$(C) $(VER)/file$(C) $(VER)/timer$(C) $(VER)/rngs$(C) \
$(VER)/sound$(C) $(VER)/picture$(C) $(VER)/xgui$(C) \
$(VER)/Imakefile $(VER)/$(PROG).man $(VER)/$(PROG).html \
$(VER)/$(A)$(WIDGET).ad $(VER)/$(wIDGET).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/vms_amd.c $(VER)/vms/vms_amd.h $(VER)/vms/vms_mmov.c \
$(VER)/win32/Makefile $(VER)/win32/w$(wIDGET).rc \
$(VER)/win32/mandrill.bmp $(VER)/win32/bump.wav $(VER)/win32/move.wav \
$(VER)/win32/w$(wIDGET).ini $(VER)/win32/$(wIDGET).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/$(wIDGET).png\
	22x22/$(wIDGET).png\
	24x24/$(wIDGET).png\
	32x32/$(wIDGET).png\
	48x48/$(wIDGET).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)
