#
# Maketool - GTK-based front end for gmake
# Copyright (c) 1999-2003 Greg Banks
# 
# 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
# 
# $Id: Makefile.in,v 1.62 2003/10/25 10:55:57 gnb Exp $
#

prefix=		@prefix@
exec_prefix=	@exec_prefix@
BINDIR=		@bindir@
INSTALL=	@INSTALL@
PACKAGE=	@PACKAGE@
VERSION=	@VERSION@
localedir=	@datadir@/locale
datadir=	@datadir@
pkgdatadir=	$(datadir)/$(PACKAGE)
libexecdir=	@libexecdir@
pkglibexecdir=	$(libexecdir)/$(PACKAGE)
helpdir=	$(pkgdatadir)/help
NON_GNU_MAKES=	@NON_GNU_MAKES@
RM=		/bin/rm -f
GTK_LIBSRC=	@GTK_LIBSRC@

CC=		@CC@
#CC=		gcc -Wall
CFLAGS=		@CFLAGS@
CPPFLAGS=	@GTK_CFLAGS@ -I$(top_srcdir) -Iicons -Iintl \
		-DLOCALEDIR=\"$(localedir)\" -DPKGLIBEXECDIR=\"$(pkglibexecdir)\" \
		-DHELPDIR=\"$(helpdir)\" -DPKGDATADIR=\"$(pkgdatadir)\" \
		@CPPFLAGS@ $(TESTCPPFLAGS)
COMPILE.c=	$(CC) $(CPPFLAGS) $(CFLAGS)
LINK.c=		$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
LDLIBS=		@GTK_LIBS@ @INTLLIBS@

SOURCES=	main.c filter.c help.c preferences.c log.c print.c ps.c find.c \
		makesys.c autoconf.c imake.c @OS_MAKESYS_SOURCE@ \
		makeprog.c gmake.c pmake.c @OS_MAKEPROG_SOURCE@ \
		ui.c uix.c task.c util.c glib_extra.c mqueue.c \
		progress.c
HEADERS=	maketool.h filter.h common.h log.h ui.h \
		util.h glib_extra.h ps.h maketool_task.h mqueue.h \
		autoconf_strs.c progress.h
OBJECTS=	$(SOURCES:.c=.o)

top_srcdir=	.
top_builddir=	.

SUBDIRS=	icons intl po makesys lib doc

###

# maketool program

all:: maketool

maketool: _libintl $(OBJECTS) _libgtk
	$(_PURIFY) $(LINK.c) -o $@ $(OBJECTS) $(LDLIBS)
	
install:: $(BINDIR)/maketool

$(BINDIR)/maketool: maketool
	test -d $(@D) || $(INSTALL) -m 755 -d $(@D)
	$(INSTALL) -m 755 maketool $@
	
uninstall::
	$(RM) $(BINDIR)/maketool
	
clean::
	$(RM) maketool *.o
		
###

# maketool_client program

all:: maketool_client

CLIENT_SOURCES=	client.c mqueue.c util.c
CLIENT_OBJECTS=	$(CLIENT_SOURCES:.c=.o)

maketool_client: _libintl $(CLIENT_OBJECTS)
	$(_PURIFY) $(LINK.c) -o $@ $(CLIENT_OBJECTS) $(LDLIBS)
	
install:: $(pkglibexecdir)/maketool_client

$(pkglibexecdir)/maketool_client: maketool_client
	test -d $(@D) || $(INSTALL) -m 755 -d $(@D)
	$(INSTALL) -m 755 maketool_client $@
	
uninstall::
	$(RM) $(pkglibexecdir)/maketool_client
	
clean::
	$(RM) maketool_client

###

# Build the list of non-gnu Makes to be included into the
# specfile.  Only built when making from the specfile.
non-gnu-makes.list:
	-$(RM) $@
	for exe in $(NON_GNU_MAKES) ; do \
	    echo $(pkglibexecdir)/`basename $$exe` >> $@ ;\
	done

distclean::
	-$(RM) non-gnu-makes.list

###

# make wrappers

install::
	for exe in $(NON_GNU_MAKES) ; do \
	    base=`basename $$exe` ;\
	    m4 -Dexe=$$exe -Dbase=$$base -Dhost_os=@host_os@ makewrap.in > makewrap ;\
	    $(INSTALL) -m 755 makewrap $(pkglibexecdir)/$$base ;\
	    $(RM) makewrap ;\
	done

uninstall::
	for exe in $(NON_GNU_MAKES) ; do \
	    $(RM) $(pkglibexecdir)/`basename $$exe` ;\
	done

###

# Assumes $PURIFY_HOME and $PUREOPTIONS are set in the environment
PURIFY_FLAGS=		-cache-dir=$(PWD)/.cache \
			-always-use-cache-dir \
			-chain-length=20
PURIFY= purify $(PURIFY_FLAGS)

pure:
	$(MAKE) _PURIFY="$(PURIFY)" all

###

# Subdirectories

# Always build at least an empty directory to keep RPM happy
install::
	$(INSTALL) -d $(helpdir)


all install uninstall clean maintainer-clean distclean::
	for subdir in $(SUBDIRS); do \
	  ( cd $$subdir ; $(MAKE) $@ ) || exit 1; \
	done

_libintl:
	cd intl ; $(MAKE) all
		
_libgtk:
	[ x"$(GTK_LIBSRC)" = x ] || (cd lib/$(GTK_LIBSRC) ; $(MAKE) all)
		
###

argstest:
	-$(RM) maketool main.o
	$(MAKE) TESTCPPFLAGS=-DARGSTEST=1 maketool
	awk -f argstest.awk < argstest.dat
	-$(RM) maketool main.o

	
###

# licence.c contains the COPYING file in C syntax. This
# avoids having to install the COPYING file on platforms
# other than Linux.
help.o: licence.c
licence.c: COPYING
	sed \
		-e 's///g' \
		-e 's/\\/\\\\/g' \
		-e 's/"/\\"/g' -e 's/^\(.*\)$$/"\1\\n"/' \
		< COPYING > $@

distclean::
	$(RM) licence.c
	
###

maintainer-clean:: distclean
distclean:: clean

.c.o:
	$(COMPILE.c) -c $<

###
# Some basic documentation (COPYRIGHT etc) used to be installed
# into /usr/doc at this point in the Makefile.  That's now
# handled by RPM -- see the %doc directive in maketool.spec.in

###
# Making a distribution
distdir=	$(PACKAGE)-$(VERSION)
DISTTAR=	$(PACKAGE)-$(VERSION).tar
DISTFILES=	\
		ABOUT-NLS COPYING COPYRIGHT TODO ChangeLog maketool.spec.in \
		README.irix \
		\
		configure.in config.guess config.sub install-sh aclocal.m4 \
		configure Makefile.in config.h.in mkinstalldirs makewrap.in \
		version.m4.in excludes \
		\
		$(SOURCES) $(HEADERS) @ALL_OS_SOURCE@ \
		$(CLIENT_SOURCES) $(CLIENT_HEADERS)


dist:
	$(RM) -r $(distdir)
	mkdir $(distdir)
	chmod 777 $(distdir)
	for file in $(DISTFILES); do \
	  test -f $(distdir)/$$file || \
	    ln $$file $(distdir) 2>/dev/null || \
	    cp -p $$file $(distdir) 2>/dev/null; \
	done
	for subdir in $(SUBDIRS); do \
	  mkdir $(distdir)/$$subdir || exit 1; \
	  chmod 777 $(distdir)/$$subdir; \
	  ( cd $$subdir ; $(MAKE) $@ ) || exit 1; \
	done
	tar chof $(DISTTAR) $(distdir)
	-$(RM) $(DISTTAR).bz2
	bzip2 $(DISTTAR)
	$(RM) -r $(distdir)

##
# deps
	
MAKEDEPEND=		makedepend
MAKEDEPENDFLAGS=	-Y

depend:
	$(MAKEDEPEND) $(MAKEDEPENDFLAGS) $(CPPFLAGS) $(SOURCES)

# Generated dependancies are appended here.
# DO NOT DELETE


syntax highlighted by Code2HTML, v. 0.9.1