# Generated automatically from Makefile.in by configure.
# GNU Make is required for this makefile
include ./VERSION
# Please run 'configure' first
-include ./install.inc

BINFILES    = src/icewm src/icewmhint src/icewmbg
LIBFILES    = lib/preferences lib/menu lib/toolbar lib/winoptions lib/keys
DOCFILES    = README TODO CHANGES COPYING FAQ INSTALL VERSION icewm.lsm
XPMDIRS     = icons ledclock taskbar mailbox
THEMES      = nice motif win95 warp3 warp4 metal2 gtk2
SPEC        = icewm.spec
LSM         = icewm.lsm

GUIEVENTSFILES = src/icesound
GNOMEFILES  = lib/IceWM.desktop

WMPROPDIR   = $(shell gnome-config --datadir)/gnome/wm-properties/

all:		base docs nls
install:	 install-base install-docs install-nls

base:
	cd src ; $(MAKE) LIBDIR=$(LIBDIR) CFGDIR=$(CFGDIR)

docs:
	cd doc ; $(MAKE) all

nls:
	cd po ; $(MAKE) all

guievents:
	cd src ; $(MAKE) icesound

gnome:

depend:
	cd src ; $(MAKE) depend

srcclean:
	cd src ; $(MAKE) clean

clean:  srcclean
	cd doc ; $(MAKE) clean

distclean: clean
	rm -f *~ config.cache config.log config.status install.inc \
	sysdep.inc src/config.h lib/preferences


maintainer-clean: clean
	rm -f $(SPEC) $(LSM) Makefile configure src/config.h.in
	cd doc ; $(MAKE) maintainer-clean

dist:	$(SPEC) $(LSM) distclean docs depend configure

configure: configure.in
	autoconf

$(SPEC): $(SPEC).in VERSION
	sed -e "s|@@VERSION@@|$(VERSION)|g" <$< >$@

$(LSM): $(LSM).in VERSION
	sed <$< >$@ \
	    -e "s|@@VERSION@@|$(VERSION)|g" \
	    -e "s|@@DATE@@|`date +%d%b%Y | tr 'a-z' 'A-Z'`|"

# Makefile TABS *SUCK*
install-base: base
	@echo ------------------------------------------
	@echo Installing icewm to $(BINDIR)
	@$(INSTALLDIR) $(BINDIR)
	@for app in $(BINFILES) ; do \
            $(INSTALLBIN) $$app $(BINDIR); \
        done
	@echo Installing defaults, icons and themes to $(LIBDIR)
	@$(INSTALLDIR) $(LIBDIR)
	@$(INSTALLDIR) $(CFGDIR)
	@for lib in $(LIBFILES) ; do \
            $(INSTALLLIB) $$lib $(LIBDIR); \
        done
	@for xpmdir in $(XPMDIRS) ; do \
            $(INSTALLDIR) $(LIBDIR)/$$xpmdir; \
            for icon in lib/$$xpmdir/*.xpm ; do \
                $(INSTALLLIB) $$icon $(LIBDIR)/$$xpmdir; \
            done; \
        done
	@for theme in $(THEMES) ; do \
            echo Installing theme: $$theme; \
            $(INSTALLDIR) $(LIBDIR)/themes/$$theme; \
            for pixmap in lib/themes/$$theme/*.xpm ; do \
                $(INSTALLLIB) $$pixmap $(LIBDIR)/themes/$$theme; \
            done; \
            for config in lib/themes/$$theme/*.theme ; do \
                $(INSTALLLIB) $$config $(LIBDIR)/themes/$$theme; \
            done; \
            for l in $(XPMDIRS) ; do \
                if [ -d lib/themes/$$theme/$$l ] ; then \
                    $(INSTALLDIR) $(LIBDIR)/themes/$$theme/$$l; \
                    for f in lib/themes/$$theme/$$l/* ; do \
                        $(INSTALLLIB) $$f $(LIBDIR)/themes/$$theme/$$l; \
                    done;\
                fi;\
            done;\
        done
	@#for a in $(ETCFILES) ; do $(INSTALLETC) $$a $(CFGDIR) ; done

install-docs: docs $(LSM)
	@echo ------------------------------------------
	@$(INSTALLDIR) $(DOCDIR)/icewm-$(VERSION)
	cp $(DOCFILES) $(DOCDIR)/icewm-$(VERSION)
	cp -r doc $(DOCDIR)/icewm-$(VERSION)

install-nls: nls
	@echo ------------------------------------------
	@cd po ; ${MAKE} install

install-guievents: guievents
	@echo ------------------------------------------
	@echo Installing GUI event support to $(BINDIR)
	@$(INSTALLDIR) $(BINDIR)
	@for a in $(GUIEVENTSFILES) ; do \
            $(INSTALLBIN) $$a $(BINDIR); \
        done

install-gnome: gnome
	@echo ------------------------------------------
	@echo Installing icewm-gnome to $(WMPROPDIR)
	@$(INSTALLDIR) $(WMPROPDIR)
	@$(INSTALLLIB) lib/IceWM.desktop $(WMPROPDIR)
