# -copyright-
#-# 
#-# Copyright (C) 1999-2001  Robin Hogan, 2021-2026 Willem Vermin
#-# 
#-# This program is free software; you can redistribute it and/or modify
#-# it under the terms of the GNU General Public License as published by
#-# the Free Software Foundation; either version 2 of the License, or
#-# (at your option) any later version.
#-# 
#-# 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.  See the
#-# GNU General Public License for more details.
#-# 
#-# You should have received a copy of the GNU General Public License
#-# along with this program; if not, write to the Free Software
#-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#-# 
bin_PROGRAMS = xpenguins

TOCC     = $(top_srcdir)/src/tocc.sh
TOASCII  = $(top_srcdir)/src/toascii.sh

EXTRA_DIST               = gen_ui_xml.sh tocc.sh toascii.sh xdo-copyright

tarfile = $(top_builddir)/$(PACKAGE)-$(VERSION).tar.gz

if MAKESELFREP
tarfile.inc: $(TOASCII)
	$(MAKE) -C $(top_builddir) dist || echo "No tarfile available during build." > $(tarfile)
	ls -l $(tarfile)
	export CC="$(CC)"; export CFLAGS="$(CFLAGS)"; $(TOASCII) < $(tarfile) > $@ 
else
tarfile.inc: 
	echo "No selfrep compiled in" | $(TOASCII) > $@
endif


xpenguins_SOURCES = main.c \
	xpenguins_config.c xpenguins_core.c xpenguins_theme.c \
	toon_associate.c toon_draw.c toon_globals.c toon_query.c \
	toon_set.c toon_core.c toon_end.c toon_init.c toon_root.c \
	toon_signal.c  main.h \
	toon.h xpenguins.h \
	debug.h \
	ixpm.c ixpm.h utils.c utils.h \
	wmctrl.c wmctrl.h xpenguins.desktop xpenguins.xpm \
	windows.c windows.h \
	ui.c ui.h ui.xml \
	button_angel.xpm button_splat.xpm \
	transwindow.c transwindow.h \
	docs.c docs.h \
	selfrep.c selfrep.h


AM_CFLAGS = -DPKGDATADIR=\""${pkgdatadir}"\"
xpenguins_CPPFLAGS = $(GTK_CFLAGS) $(X11_CFLAGS) -rdynamic
xpenguins_LDADD    = libxdo.a $(GTK_LIBS) $(X11_LIBS)
libxdo_a_CPPFLAGS  = $(X11_CFLAGS)

if MAKESELFREP
   xpenguins_CPPFLAGS += -DSELFREP
endif

noinst_LIBRARIES = libxdo.a
libxdo_a_SOURCES = xdo.c xdo_search.c xdo.h xdo_util.h xdo_version.h

xpenguins-selfrep.$(OBJEXT): tarfile.inc

desktopdir = $(datadir)/applications
desktop_DATA = $(PACKAGE).desktop

appicondir=$(datadir)/pixmaps
appicon_DATA=$(PACKAGE).xpm

ui_xml.h: ui.xml
	@echo "Creating $@ from $<"
	$(top_srcdir)/src/gen_ui_xml.sh $(top_srcdir)

changelog.inc: $(top_srcdir)/ChangeLog $(TOCC)
	$(TOCC) < $(top_srcdir)/ChangeLog > $@

xpenguins-docs.$(OBJEXT): changelog.inc

xpenguins-ui.$(OBJEXT): ui_xml.h

CLEANFILES = ui_xml.h changelog.inc tarfile.inc toascii toascii.c
