1# Makefile.in --
2#
3#	This file is a Makefile for Sample TEA Extension.  If it has the name
4#	"Makefile.in" then it is a template for a Makefile;  to generate the
5#	actual Makefile, run "./configure", which is a configuration script
6#	generated by the "autoconf" program (constructs like "@foo@" will get
7#	replaced in the actual Makefile.
8#
9# Copyright (c) 1999 Scriptics Corporation.
10# Copyright (c) 2002-2005 ActiveState Corporation.
11#
12# See the file "license.terms" for information on usage and redistribution
13# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14#
15# RCS: @(#) $Id: Makefile.in,v 1.17 2005/11/20 21:29:13 hobbs Exp $
16
17#========================================================================
18# Edit the following few lines when writing a new extension
19#========================================================================
20
21#========================================================================
22# Enumerate the names of the source files included in this package.
23# This will be used when a dist target is added to the Makefile.
24# EXTRA_SOURCES will be replaced by WIN_SOURCES or UNIX_SOURCES, as is
25# appropriate for your platform.  It is not important to specify the
26# directory, as long as it is the $(srcdir) or in the generic, win or
27# unix subdirectory.
28#========================================================================
29
30PKG_SOURCES	= @PKG_SOURCES@
31PKG_OBJECTS	= @PKG_OBJECTS@ @LIBOBJS@
32
33#========================================================================
34# Identify the object files.  This replaces .c with .$(OBJEXT) for all
35# the named source files.   These objects are created and linked into the
36# final library.  In these do not correspond directly to the source files
37# above, you will need to enumerate the object files here.
38# Normally we would use $(OBJEXT), but certain make executables won't do
39# the extra macro in a macro conversion properly.
40#
41# "tclx_LIB_FILE" refers to the library (dynamic or static as per
42# configuration options) composed of the named objects.
43#========================================================================
44
45TEST_OBJS	= tclXunixTest.$(OBJEXT)
46
47#========================================================================
48# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
49# this package that need to be installed, if any.
50#========================================================================
51
52PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
53
54#========================================================================
55# This is a list of public header files to be installed, if any.
56#========================================================================
57
58PKG_HEADERS	= @PKG_HEADERS@
59
60#========================================================================
61# Add additional lines to handle any additional AC_SUBST cases that
62# have been added to the configure script.
63#========================================================================
64
65HELP_DIR	= @HELP_DIR@
66HELP_DIR_NATIVE	= `@CYGPATH@ ${HELP_DIR}`
67
68#========================================================================
69# Nothing of the variables below this line need to be changed.  Please
70# check the TARGETS section below to make sure the make targets are
71# correct.
72#========================================================================
73
74#========================================================================
75# "PKG_LIB_FILE" refers to the library (dynamic or static as per
76# configuration options) composed of the named objects.
77#========================================================================
78
79PKG_LIB_FILE	= @PKG_LIB_FILE@
80
81lib_BINARIES	= $(PKG_LIB_FILE)
82BINARIES	= $(lib_BINARIES)
83
84SHELL		= @SHELL@
85
86srcdir		= @srcdir@
87prefix		= @prefix@
88exec_prefix	= @exec_prefix@
89
90bindir		= @bindir@
91libdir		= @libdir@
92datadir		= @datadir@
93mandir		= @mandir@
94includedir	= @includedir@
95
96DESTDIR		=
97
98PKG_DIR		= $(PACKAGE_NAME)$(PACKAGE_VERSION)
99pkgdatadir	= $(datadir)/$(PKG_DIR)
100pkglibdir	= $(libdir)/$(PKG_DIR)
101pkgincludedir	= $(includedir)/$(PKG_DIR)
102
103top_builddir	= .
104
105INSTALL		= @INSTALL@
106INSTALL_PROGRAM	= @INSTALL_PROGRAM@
107INSTALL_DATA	= @INSTALL_DATA@
108INSTALL_SCRIPT	= @INSTALL_SCRIPT@
109
110PACKAGE_NAME	= @PACKAGE_NAME@
111PACKAGE_VERSION	= @PACKAGE_VERSION@
112CC		= @CC@
113CFLAGS_DEFAULT	= @CFLAGS_DEFAULT@
114CFLAGS_WARNING	= @CFLAGS_WARNING@
115CLEANFILES	= @CLEANFILES@
116EXEEXT		= @EXEEXT@
117LDFLAGS_DEFAULT	= @LDFLAGS_DEFAULT@
118MAKE_LIB	= @MAKE_LIB@
119MAKE_SHARED_LIB	= @MAKE_SHARED_LIB@
120MAKE_STATIC_LIB	= @MAKE_STATIC_LIB@
121MAKE_STUB_LIB	= @MAKE_STUB_LIB@
122OBJEXT		= @OBJEXT@
123RANLIB		= @RANLIB@
124RANLIB_STUB	= @RANLIB_STUB@
125SHLIB_CFLAGS	= @SHLIB_CFLAGS@
126SHLIB_LD	= @SHLIB_LD@
127SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@
128STLIB_LD	= @STLIB_LD@
129TCL_DEFS	= @TCL_DEFS@
130TCL_BIN_DIR	= @TCL_BIN_DIR@
131TCL_SRC_DIR	= @TCL_SRC_DIR@
132# This is necessary for packages that use private Tcl headers
133TCL_TOP_DIR_NATIVE	= @TCL_TOP_DIR_NATIVE@
134# Not used, but retained for reference of what libs Tcl required
135TCL_LIBS	= @TCL_LIBS@
136
137#========================================================================
138# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
139# package without installing.  The other environment variables allow us
140# to test against an uninstalled Tcl.  Add special env vars that you
141# require for testing here (like TCLX_LIBRARY).
142#========================================================================
143
144EXTRA_PATH	= $(top_builddir):$(TCL_BIN_DIR)
145TCLSH_ENV	= TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \
146		  TCLX_LIBRARY=`@CYGPATH@ $(srcdir)/library` \
147		  TCLX_HELP_DIR="$(HELP_DIR_NATIVE)" \
148		  @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
149		  PATH="$(EXTRA_PATH):$(PATH)" \
150		  TCLLIBPATH="$(top_builddir)"
151TCLSH_PROG	= @TCLSH_PROG@
152TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
153SHARED_BUILD	= @SHARED_BUILD@
154
155TCLX_TOOLS_SRC_DIR = `@CYGPATH@ $(srcdir)/unix/tools`
156TCLX_DOC_DIR	   = `@CYGPATH@ $(srcdir)/doc`
157TCLX_INSTCOPY	   = ${TCLSH} ${TCLX_TOOLS_SRC_DIR}/instcopy.tcl
158TCLX_HELP_INST_DIR = `@CYGPATH@ $(DESTDIR)$(pkglibdir)/help`
159
160INCLUDES	= @PKG_INCLUDES@ @TCL_INCLUDES@
161
162PKG_CFLAGS	= @PKG_CFLAGS@
163
164DEFS		= @DEFS@ $(PKG_CFLAGS)
165
166CONFIG_CLEAN_FILES = Makefile
167
168CPPFLAGS	= @CPPFLAGS@
169LIBS		= @PKG_LIBS@ @LIBS@
170AR		= @AR@
171CFLAGS		= @CFLAGS@
172COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
173
174#========================================================================
175# Start of user-definable TARGETS section
176#========================================================================
177
178#========================================================================
179# TEA TARGETS.  Please note that the "libraries:" target refers to platform
180# independent files, and the "binaries:" target inclues executable programs and
181# platform-dependent libraries.  Modify these targets so that they install
182# the various pieces of your package.  The make and install rules
183# for the BINARIES that you specified above have already been done.
184#========================================================================
185
186all: binaries libraries doc
187
188#========================================================================
189# The binaries target builds executable programs, Windows .dll's, unix
190# shared/static libraries, and any other platform-dependent files.
191# The list of targets to build for "binaries:" is specified at the top
192# of the Makefile, in the "BINARIES" variable.
193#========================================================================
194
195binaries: $(BINARIES) pkgIndex.tcl
196
197libraries:
198
199doc: @BUILDHELP@
200
201install: all install-binaries install-libraries install-doc
202
203install-binaries: binaries install-lib-binaries install-bin-binaries
204
205#========================================================================
206# This rule installs platform-independent files, such as header files.
207#========================================================================
208
209install-libraries: libraries
210	@mkdir -p $(DESTDIR)$(includedir)
211	@echo "Installing header files in $(DESTDIR)$(includedir)"
212	@list='$(PKG_HEADERS)'; for i in $$list; do \
213	    echo "Installing $(srcdir)/$$i" ; \
214	    $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \
215	done;
216
217#========================================================================
218# Install documentation.  Unix manpages should go in the $(mandir)
219# directory.
220#========================================================================
221
222install-doc: doc install-help
223	@mkdir -p $(DESTDIR)$(mandir)/mann
224	@echo "Installing documentation in $(DESTDIR)$(mandir)"
225	@list='$(srcdir)/doc/*.n'; for i in $$list; do \
226	    echo "Installing $$i"; \
227	    rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \
228	    $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
229	done
230
231test: binaries libraries
232	$(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
233
234shell: binaries libraries
235	@$(TCLSH) $(SCRIPT)
236
237GDB = gdb
238gdb:
239	$(TCLSH_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT)
240
241#VALGRINDFLAGS=--logfile-fd=9
242#TESTFLAGS=9> valgrind.log
243valgrindtest: binaries libraries
244	$(TCLSH_ENV) valgrind --num-callers=12 --leak-resolution=high -v --leak-check=yes --show-reachable=yes $(VALGRINDFLAGS) $(TCLSH_PROG) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
245valgrind: binaries libraries
246	$(TCLSH_ENV) valgrind --num-callers=12 --leak-resolution=high -v --leak-check=yes --show-reachable=yes $(VALGRINDFLAGS) $(TCLSH_PROG) $(SCRIPT)
247
248depend:
249
250#========================================================================
251# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
252# mentioned above.  That will ensure that this target is built when you
253# run "make binaries".
254#
255# The $(PKG_OBJECTS) objects are created and linked into the final
256# library.  In most cases these object files will correspond to the
257# source files above.
258#========================================================================
259
260$(PKG_LIB_FILE): $(PKG_OBJECTS)
261	-rm -f $(PKG_LIB_FILE)
262	${MAKE_LIB}
263	$(RANLIB) $(PKG_LIB_FILE)
264
265pkgIndex.tcl:
266	(echo 'package ifneeded Tclx $(PACKAGE_VERSION) \
267		[list load [file join $$dir $(PKG_LIB_FILE)] Tclx]'\
268	) > pkgIndex.tcl
269
270#========================================================================
271# We need to enumerate the list of .c to .o lines here.
272#
273# In the following lines, $(srcdir) refers to the toplevel directory
274# containing your extension.  If your sources are in a subdirectory,
275# you will have to modify the paths to reflect this:
276#
277# sample.$(OBJEXT): $(srcdir)/generic/sample.c
278# 	$(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@
279#
280# Setting the VPATH variable to a list of paths will cause the 
281# makefile to look into these paths when resolving .c to .obj
282# dependencies.
283#========================================================================
284
285VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/compat
286
287.c.@OBJEXT@:
288	$(COMPILE) -c `@CYGPATH@ $<` -o $@
289
290#========================================================================
291# Distribution creation
292# You may need to tweak this target to make it work correctly.
293#========================================================================
294
295#COMPRESS	= tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
296COMPRESS	= tar jcvf $(PKG_DIR).tar.bz2 $(PKG_DIR)
297DIST_ROOT	= /tmp/dist
298DIST_DIR	= $(DIST_ROOT)/$(PKG_DIR)
299
300dist-clean:
301	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
302
303dist: dist-clean
304	mkdir -p $(DIST_DIR)
305	cp -p $(srcdir)/ChangeLog $(srcdir)/README* $(srcdir)/license* \
306		$(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/*.in \
307		$(DIST_DIR)/
308	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
309	chmod 775 $(DIST_DIR)/configure $(DIST_DIR)/configure.in
310
311	mkdir $(DIST_DIR)/tclconfig
312	cp $(srcdir)/tclconfig/install-sh $(srcdir)/tclconfig/tcl.m4 \
313		$(DIST_DIR)/tclconfig/
314	chmod 664 $(DIST_DIR)/tclconfig/tcl.m4
315	chmod +x $(DIST_DIR)/tclconfig/install-sh
316
317	list='doc generic library tests tests/compat unix unix/tools win'; \
318	for p in $$list; do \
319	    if test -d $(srcdir)/$$p ; then \
320		mkdir $(DIST_DIR)/$$p; \
321		cp -p $(srcdir)/$$p/*.* $(DIST_DIR)/$$p/; \
322	    fi; \
323	done
324
325	cp -p $(srcdir)/unix/INSTALL $(DIST_DIR)/unix/;
326	cp -p $(srcdir)/unix/tools/*manpages $(DIST_DIR)/unix/tools/;
327
328	(cd $(DIST_ROOT); $(COMPRESS);)
329
330#========================================================================
331# End of user-definable section
332#========================================================================
333
334#========================================================================
335# Don't modify the file to clean here.  Instead, set the "CLEANFILES"
336# variable in configure.in
337#========================================================================
338
339clean: helpclean
340	-test -z "$(BINARIES)" || rm -f $(BINARIES)
341	-rm -f *.$(OBJEXT) core *.core
342	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
343
344helpclean:
345	-rm -rf $(HELP_DIR)
346
347distclean: clean
348	-rm -f *.tab.c
349	-rm -f $(CONFIG_CLEAN_FILES)
350	-rm -f config.cache config.log config.status
351
352#========================================================================
353# Install binary object libraries.  On Windows this includes both .dll and
354# .lib files.  Because the .lib files are not explicitly listed anywhere,
355# we need to deduce their existence from the .dll file of the same name.
356# Library files go into the lib directory.
357# In addition, this will generate the pkgIndex.tcl
358# file in the install location (assuming it can find a usable tclsh shell)
359#
360# You should not have to modify this target.
361#========================================================================
362
363install-lib-binaries:
364	@mkdir -p $(DESTDIR)$(pkglibdir)
365	@list='$(lib_BINARIES)'; for p in $$list; do \
366	  if test -f $$p; then \
367	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
368	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \
369	    stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \
370	    if test "x$$stub" = "xstub"; then \
371		echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \
372		$(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \
373	    else \
374		echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \
375		$(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \
376	    fi; \
377	    ext=`echo $$p|sed -e "s/.*\.//"`; \
378	    if test "x$$ext" = "xdll"; then \
379		lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
380		if test -f $$lib; then \
381		    echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
382	            $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \
383		fi; \
384	    fi; \
385	  fi; \
386	done
387	@list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
388	  if test -f $(srcdir)/$$p; then \
389	    destp=`basename $$p`; \
390	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
391	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
392	  fi; \
393	done
394	@if test "x$(SHARED_BUILD)" = "x1"; then \
395	    echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \
396	    $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \
397	fi
398
399#========================================================================
400# Install binary executables (e.g. .exe files and dependent .dll files)
401# This is for files that must go in the bin directory (located next to
402# wish and tclsh), like dependent .dll files on Windows.
403#
404# You should not have to modify this target, except to define bin_BINARIES
405# above if necessary.
406#========================================================================
407
408install-bin-binaries:
409	@mkdir -p $(DESTDIR)$(bindir)
410	@list='$(bin_BINARIES)'; for p in $$list; do \
411	  if test -f $$p; then \
412	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
413	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \
414	  fi; \
415	done
416
417.SUFFIXES: .c .$(OBJEXT)
418
419Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
420	cd $(top_builddir) \
421	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
422
423uninstall-binaries:
424	list='$(lib_BINARIES)'; for p in $$list; do \
425	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
426	done
427	list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
428	  p=`basename $$p`; \
429	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
430	done
431	list='$(bin_BINARIES)'; for p in $$list; do \
432	  rm -f $(DESTDIR)$(bindir)/$$p; \
433	done
434
435.PHONY: all binaries clean depend distclean doc install libraries test
436
437# Tell versions [3.59,3.63) of GNU make to not export all variables.
438# Otherwise a system limit (for SysV at least) may be exceeded.
439.NOEXPORT:
440
441#------------------------------------------------------------------------------
442# Build help for Tcl & TclX.  These files are normally part of the
443# distribution and not rebuilt by users.
444#
445buildhelp: help
446help: $(BINARIES)
447	if test ! -d "${HELP_DIR}" ; then \
448	    mkdir -p "${HELP_DIR}" ; \
449	    ${TCLSH} ${TCLX_TOOLS_SRC_DIR}/bldmanhelp.tcl \
450		`@CYGPATH@ ${TCL_SRC_DIR}/doc` \
451		${TCLX_TOOLS_SRC_DIR}/tclmanpages ${HELP_DIR_NATIVE} Tcl.brf; \
452	    ${TCLSH} ${TCLX_TOOLS_SRC_DIR}/runbuildhelp.tcl \
453		${HELP_DIR_NATIVE} TclX.brf ${TCLX_DOC_DIR}/TclX.n; \
454	fi
455
456install-help:
457	@if test -d "${HELP_DIR}" ; then \
458	     echo "Installing TclX help files in ${TCLX_HELP_INST_DIR}"; \
459	     mkdir -p ${TCLX_HELP_INST_DIR}; \
460	     ${TCLX_INSTCOPY} ${HELP_DIR_NATIVE} ${TCLX_HELP_INST_DIR}; \
461	fi
462