#
# @configure_input@
#

### Identification division.
#

PACKAGE 	= tile
VERSION 	= 0.4

### Environment division.
#
srcdir		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@

TCL_PKGPATH	= $(prefix)/lib
pkglibdir	= $(TCL_PKGPATH)/$(PACKAGE)$(VERSION)

EXTRA_DEFINES	=
DEFS		= @DEFS@ $(EXTRA_DEFINES)
LIBS		= @LIBS@
INCLUDES	= @TCL_INCLUDES@ @TK_INCLUDES@ @TK_XINCLUDES@ -I@srcdir@

TCL_STUB_LIB_SPEC	= @TCL_STUB_LIB_SPEC@
TK_STUB_LIB_SPEC	= @TK_STUB_LIB_SPEC@ 
TK_LIB_SPEC		= @TK_LIB_SPEC@ 

PKG_LIBS		= @PKG_LIBS@

CC 		= @CC@
SHLIB_LD	= @SHLIB_LD@
WISH_PROG	= @WISH_PROG@
INSTALL		= @INSTALL@
INSTALL_DATA	= @INSTALL_DATA@

CFLAGS_WARNING	= @CFLAGS_WARNING@
CFLAGS_OPTIMIZE	= @CFLAGS_OPTIMIZE@
CFLAGS_DEBUG	= @CFLAGS_DEBUG@
CFLAGS_DEFAULT	= @CFLAGS_DEFAULT@
SHLIB_CFLAGS	= @SHLIB_CFLAGS@
CFLAGS		= @CFLAGS@

LDFLAGS_OPTIMIZE= @LDFLAGS_OPTIMIZE@
LDFLAGS_DEBUG	= @LDFLAGS_DEBUG@
LDFLAGS_DEFAULT	= @LDFLAGS_DEFAULT@
SHLIB_LD_FLAGS	= @SHLIB_LD_FLAGS@

OBJEXT		= @OBJEXT@
SHLIB_SUFFIX	= @SHLIB_SUFFIX@
SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@


### Data division.
#

CLEANFILES	= *.o *.obj $(tile_LIB_FILE)

tile_LIB_FILE	= $(PACKAGE)$(SHLIB_SUFFIX)
tile_OBJECTS 	= \
    tkstate.$(OBJEXT) \
    tile.$(OBJEXT) \
    frame.$(OBJEXT) \
    button.$(OBJEXT) \
    scrollbar.$(OBJEXT) \
    scale.$(OBJEXT) \
    notebook.$(OBJEXT) \
    layout.$(OBJEXT) \
    widget.$(OBJEXT) \
    trace.$(OBJEXT) \
    track.$(OBJEXT) \
    altTheme.$(OBJEXT) \
    tkElements.$(OBJEXT) \
    tkTheme.$(OBJEXT) \
    cache.$(OBJEXT) \
    stepTheme.$(OBJEXT) \
    pixmapTheme.$(OBJEXT) \
    @PLATFORM_OBJS@

X11_OBJS	= 
WIN_OBJS	= winTheme.$(OBJEXT) xpTheme.$(OBJEXT) monitor.$(OBJEXT)
MAC_OBJS	= aquaTheme.$(OBJEXT)

WISH_ENV	= TILE_LIBRARY="$(TILE_LIBRARY)"
WISH		= $(WISH_ENV) $(WISH_PROG)

### Procedure division.
#

VPATH = @srcdir@:@srcdir@/../win:@srcdir@/../macosx

default:	package

all:		package

.PHONY: default all package clean distclean doc install installdirs 
.PHONY: test valgrind

### Targets section.
#

package:	$(tile_LIB_FILE)
install:	all install-package

### Build stuff section.
#

.SUFFIXES: .c .@OBJEXT@

.c.@OBJEXT@:
	@echo $<
	@$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) -c $< -o $@

$(tile_LIB_FILE): $(tile_OBJECTS)
	-rm -f $(tile_LIB_FILE)
	$(SHLIB_LD) @SHLIB_LD_OUT@$@ $(SHLIB_LD_FLAGS) \
		$(tile_OBJECTS) $(PKG_LIBS) $(SHLIB_LD_LIBS) \
		$(TCL_STUB_LIB_SPEC) $(TK_LIB_SPEC)

# @@@ Replace TK_LIB_SPEC w/TK_STUB_LIB_SPEC

### Documentation section.
#

### Test stuff section.
#
TILE_LIBRARY	= $(srcdir)/../library
TESTFLAGS 	= -verbose e

test ::
	$(WISH) $(srcdir)/../tests/all.tcl $(TESTFLAGS)

valgrind ::
	$(WISH_ENV) valgrind $(WISH_PROG) $(srcdir)/../tests/all.tcl \
		-verbose pbe -singleproc true

demo ::
	$(WISH) $(srcdir)/../demos/demo.tcl

shell ::
	$(WISH) $(SCRIPT)

### Install stuff section.
#

$(DESTDIR)$(pkglibdir):
	mkdir -p $(DESTDIR)$(pkglibdir)

install-package: package $(DESTDIR)$(pkglibdir)
	$(INSTALL_DATA) $(tile_LIB_FILE) $(DESTDIR)$(pkglibdir)
	$(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir)
	for libfile in $(TILE_LIBRARY)/*.tcl ; do \
	    $(INSTALL_DATA) $$libfile $(DESTDIR)$(pkglibdir) ; done

### Maintain stuff section.
#

Makefile : $(srcdir)/Makefile.in config.status
	sh config.status

tags ::
	ctags *.[ch]

### Cleanup section.
#
clean::
	-rm -f $(CLEANFILES)

distclean: clean
	-rm -f Makefile config.cache config.log config.status pkgIndex.tcl

# *EOF*
