1# Makefile.in --
2#
3#	This file is a Makefile for Memchan 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-2005 Andreas Kupries <andreas_kupries@users.sourceforge.net>
10# Copyright (c) 2002 ActiveState SRL.
11# Copyright (c) 2004 Pat Thoyts
12# Copyright (c) 2002-2005 ActiveState Corporation.
13#
14# See the file "license.terms" for information on usage and redistribution
15# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16#
17# RCS: @(#) $Id: Makefile.in,v 1.26 2010/12/08 21:49:08 andreas_kupries Exp $
18
19MPEXPAND  = $(TCLSH) $(srcdir)/tools/mpexpand.tcl
20DOC_SOURCES = \
21	memchan.man \
22	memchanapi.man \
23	fifo.man \
24	fifo2.man \
25	null.man \
26	zero.man \
27	random.man
28
29DOC_NROFF = $(DOC_SOURCES:.man=.n)
30DOC_HTML  = $(DOC_SOURCES:.man=.html)
31
32#========================================================================
33# Nothing of the variables below this line should need to be changed.
34# Please check the TARGETS section below to make sure the make targets
35# are correct.
36#========================================================================
37
38#========================================================================
39# The names of the source files is defined in the configure script.
40# The object files are used for linking into the final library.
41# This will be used when a dist target is added to the Makefile.
42# It is not important to specify the directory, as long as it is the
43# $(srcdir) or in the generic, win or unix subdirectory.
44#========================================================================
45
46PKG_SOURCES	= @PKG_SOURCES@
47PKG_OBJECTS	= @PKG_OBJECTS@
48
49PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
50PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
51
52#========================================================================
53# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
54# this package that need to be installed, if any.
55#========================================================================
56
57PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
58
59#========================================================================
60# This is a list of public header files to be installed, if any.
61#========================================================================
62
63PKG_HEADERS	= @PKG_HEADERS@
64
65#========================================================================
66# "PKG_LIB_FILE" refers to the library (dynamic or static as per
67# configuration options) composed of the named objects.
68#========================================================================
69
70PKG_LIB_FILE	= @PKG_LIB_FILE@
71PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
72
73lib_BINARIES	= $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE)
74BINARIES	= $(lib_BINARIES)
75
76SHELL		= @SHELL@
77
78srcdir		= @srcdir@
79prefix		= @prefix@
80exec_prefix	= @exec_prefix@
81
82bindir		= @bindir@
83libdir		= @libdir@
84datadir		= @datadir@
85mandir		= @mandir@
86includedir	= @includedir@
87datarootdir	= @datarootdir@
88
89DESTDIR		=
90
91PKG_DIR		= $(PACKAGE_NAME)$(PACKAGE_VERSION)
92pkgdatadir	= $(datadir)/$(PKG_DIR)
93pkglibdir	= $(libdir)/$(PKG_DIR)
94pkgincludedir	= $(includedir)/$(PKG_DIR)
95
96top_builddir	= .
97
98INSTALL		= @INSTALL@
99INSTALL_PROGRAM	= @INSTALL_PROGRAM@
100INSTALL_DATA	= @INSTALL_DATA@
101INSTALL_SCRIPT	= @INSTALL_SCRIPT@
102
103PACKAGE_NAME	= @PACKAGE_NAME@
104PACKAGE_VERSION	= @PACKAGE_VERSION@
105CC		= @CC@
106CFLAGS_DEFAULT	= @CFLAGS_DEFAULT@
107CFLAGS_WARNING	= @CFLAGS_WARNING@
108CLEANFILES	= @CLEANFILES@
109EXEEXT		= @EXEEXT@
110LDFLAGS_DEFAULT	= @LDFLAGS_DEFAULT@
111MAKE_LIB	= @MAKE_LIB@
112MAKE_SHARED_LIB	= @MAKE_SHARED_LIB@
113MAKE_STATIC_LIB	= @MAKE_STATIC_LIB@
114MAKE_STUB_LIB	= @MAKE_STUB_LIB@
115OBJEXT		= @OBJEXT@
116RANLIB		= @RANLIB@
117RANLIB_STUB	= @RANLIB_STUB@
118SHLIB_CFLAGS	= @SHLIB_CFLAGS@
119SHLIB_LD	= @SHLIB_LD@
120SHLIB_LD_LIBS	= @SHLIB_LD_LIBS@
121STLIB_LD	= @STLIB_LD@
122SHLIB_SUFFIX	= @@
123TCL_DEFS	= @TCL_DEFS@
124TCL_BIN_DIR	= @TCL_BIN_DIR@
125TCL_SRC_DIR	= @TCL_SRC_DIR@
126# This is necessary for packages that use private Tcl headers
127TCL_TOP_DIR_NATIVE	= @TCL_TOP_DIR_NATIVE@
128# Not used, but retained for reference of what libs Tcl required
129TCL_LIBS	= @TCL_LIBS@
130
131#========================================================================
132# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
133# package without installing.  The other environment variables allow us
134# to test against an uninstalled Tcl.  Add special env vars that you
135# require for testing here (like TCLX_LIBRARY).
136#========================================================================
137
138EXTRA_PATH	= $(top_builddir):$(TCL_BIN_DIR)
139TCLSH_ENV	= TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library` \
140		  @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
141		  PATH="$(EXTRA_PATH):$(PATH)" \
142		  TCLLIBPATH="$(top_builddir)"
143TCLSH_PROG	= @TCLSH_PROG@
144TCLSH		= $(TCLSH_ENV) $(TCLSH_PROG)
145SHARED_BUILD	= @SHARED_BUILD@
146
147INCLUDES	= @PKG_INCLUDES@ @TCL_INCLUDES@
148
149PKG_CFLAGS	= @PKG_CFLAGS@
150
151# TCL_DEFS is not strictly need here, but if you remove it, then you
152# must make sure that configure.in checks for the necessary components
153# that your library may use.  TCL_DEFS can actually be a problem if
154# you do not compile with a similar machine setup as the Tcl core was
155# compiled with.
156#DEFS		= $(TCL_DEFS) @DEFS@ $(PKG_CFLAGS)
157DEFS		= @DEFS@ $(PKG_CFLAGS)
158
159CONFIG_CLEAN_FILES = Makefile
160
161CPPFLAGS	= @CPPFLAGS@
162LIBS		= @PKG_LIBS@ @LIBS@
163AR		= @AR@
164CFLAGS		= @CFLAGS@
165COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
166
167.SUFFIXES: .c .$(OBJEXT) .man .n .html
168
169#========================================================================
170# Start of user-definable TARGETS section
171#========================================================================
172
173#========================================================================
174# TEA TARGETS.  Please note that the "libraries:" target refers to platform
175# independent files, and the "binaries:" target inclues executable programs and
176# platform-dependent libraries.  Modify these targets so that they install
177# the various pieces of your package.  The make and install rules
178# for the BINARIES that you specified above have already been done.
179#========================================================================
180
181all: binaries libraries doc
182
183#========================================================================
184# The binaries target builds executable programs, Windows .dll's, unix
185# shared/static libraries, and any other platform-dependent files.
186# The list of targets to build for "binaries:" is specified at the top
187# of the Makefile, in the "BINARIES" variable.
188#========================================================================
189
190binaries: $(BINARIES) pkgIndex.tcl-hand
191
192libraries:
193
194doc: $(DOC_NROFF)
195doc-html: $(DOC_HTML)
196
197doc-old:
198	if [ "x$(srcdir)" != "x." -a "x$(srcdir)" != "x`pwd`" ] ; then	\
199		rm -rf tools htdocs		; \
200		cp -rf $(srcdir)/tools .	; \
201		cp -rf $(srcdir)/htdocs .	; \
202		rm -rf doc ; mkdir doc		; \
203		cp $(srcdir)/doc/*.man doc/	; \
204	fi
205	cd doc ; $(TCLSH_ENV) ../tools/nroff_regen "$(TCLSH_PROG)"
206
207.man.n:
208	$(MPEXPAND) nroff `@CYGPATH@ $<` $@
209
210.man.html:
211	$(MPEXPAND) html  `@CYGPATH@ $<` $@
212
213install: all install-binaries install-libraries install-doc
214
215install-binaries: binaries install-lib-binaries install-bin-binaries
216
217#========================================================================
218# This rule installs platform-independent files, such as header files.
219#========================================================================
220
221install-libraries: libraries
222	@mkdir -p $(DESTDIR)$(includedir)
223	@echo "Installing header files in $(DESTDIR)$(includedir)"
224	@list='$(PKG_HEADERS)'; for i in $$list; do \
225	    echo "Installing $(srcdir)/$$i" ; \
226	    $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) ; \
227	done;
228
229#========================================================================
230# Install documentation.  Unix manpages should go in the $(mandir)
231# directory.
232#========================================================================
233
234install-doc: doc
235	@mkdir -p $(DESTDIR)$(mandir)/mann
236	@echo "Installing documentation in $(DESTDIR)$(mandir)"
237	@for i in $(DOC_NROFF); do \
238	    echo "Installing $$i"; \
239	    rm -f $(DESTDIR)$(mandir)/mann/`basename $$i`; \
240	    $(INSTALL_DATA) doc/$$i $(DESTDIR)$(mandir)/mann ; \
241	done
242
243test: binaries libraries
244	echo load $(PKG_LIB_FILE) $(PACKAGE_NAME)\; cd $(srcdir)/tests \; source all | $(TCLSH) $(TESTFLAGS)
245
246shell: binaries libraries
247	@$(TCLSH) $(SCRIPT)
248
249gdb:
250	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)
251
252depend:
253
254#========================================================================
255# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
256# mentioned above.  That will ensure that this target is built when you
257# run "make binaries".
258#
259# The $(PKG_OBJECTS) objects are created and linked into the final
260# library.  In most cases these object files will correspond to the
261# source files above.
262#========================================================================
263
264$(PKG_LIB_FILE): $(PKG_OBJECTS)
265	-rm -f $(PKG_LIB_FILE)
266	${MAKE_LIB}
267	$(RANLIB) $(PKG_LIB_FILE)
268
269$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS)
270	-rm -f $(PKG_STUB_LIB_FILE)
271	${MAKE_STUB_LIB}
272	$(RANLIB_STUB) $(PKG_STUB_LIB_FILE)
273
274#========================================================================
275# We need to enumerate the list of .c to .o lines here.
276#
277# In the following lines, $(srcdir) refers to the toplevel directory
278# containing your extension.  If your sources are in a subdirectory,
279# you will have to modify the paths to reflect this:
280#
281# Memchan.$(OBJEXT): $(srcdir)/generic/Memchan.c
282# 	$(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/Memchan.c` -o $@
283#
284# Setting the VPATH variable to a list of paths will cause the makefile
285# to look into these paths when resolving .c to .obj dependencies.
286# As necessary, add $(srcdir):$(srcdir)/compat:....
287#========================================================================
288
289VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/isaac:$(srcdir)/doc
290
291.c.@OBJEXT@:
292	$(COMPILE) -c `@CYGPATH@ $<` -o $@
293
294#========================================================================
295# Create the pkgIndex.tcl file.
296# It is usually easiest to let Tcl do this for you with pkg_mkIndex, but
297# you may find that you need to customize the package.  If so, either
298# modify the -hand version, or create a pkgIndex.tcl.in file and have
299# the configure script output the pkgIndex.tcl by editing configure.in.
300#========================================================================
301
302pkgIndex.tcl:
303	( echo pkg_mkIndex . $(PKG_LIB_FILE) \; exit; ) | $(TCLSH)
304
305pkgIndex.tcl-hand:
306	(echo 'package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
307	    [list load [file join $$dir $(PKG_LIB_FILE)]]'\
308	) > pkgIndex.tcl
309
310#========================================================================
311# Distribution creation
312# You may need to tweak this target to make it work correctly.
313#========================================================================
314
315#COMPRESS	= tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
316COMPRESS	= tar zcvf $(PKG_DIR).tar.gz $(PKG_DIR)
317DIST_ROOT	= /tmp/dist
318DIST_DIR	= $(DIST_ROOT)/$(PKG_DIR)
319
320dist-clean:
321	rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
322
323dist: dist-clean
324	mkdir -p $(DIST_DIR)
325	cp -p   $(srcdir)/ChangeLog \
326		$(srcdir)/README* \
327		$(srcdir)/doc/license* \
328		$(srcdir)/aclocal.m4 \
329		$(srcdir)/configure \
330		$(srcdir)/*.in \
331		$(DIST_DIR)/
332	chmod 664 $(DIST_DIR)/Makefile.in $(DIST_DIR)/aclocal.m4
333	chmod 775 $(DIST_DIR)/configure   $(DIST_DIR)/configure.in
334	mkdir $(DIST_DIR)/tclconfig
335	cp -p 	$(srcdir)/tclconfig/install-sh \
336		$(srcdir)/tclconfig/tcl.m4 \
337		$(DIST_DIR)/tclconfig/
338	chmod 664 $(DIST_DIR)/tclconfig/tcl.m4
339	chmod +x  $(DIST_DIR)/tclconfig/install-sh
340	-list='htdocs/art doc demos generic library mac tests win isaac tea.tests tools tools/rules'; \
341	for p in $$list; do \
342	    if test -d $(srcdir)/$$p ; then \
343		mkdir -p $(DIST_DIR)/$$p; \
344		cp -p `ls -d $(srcdir)/$$p/*|grep -v CVS` $(DIST_DIR)/$$p/; \
345	    fi; \
346	done
347	-mv $(DIST_DIR)/htdocs/art $(DIST_DIR)/doc/art
348	rm -rf $(DIST_DIR)/htdocs
349	(cd $(DIST_ROOT); $(COMPRESS);)
350	mv $(DIST_ROOT)/$(PKG_DIR).tar.gz .
351	rm -rf $(DIST_ROOT)/$(PKG_DIR)
352
353dist_orig:
354	rm -rf $(PKG_DIR)*
355	ls -d $(srcdir)/* > __FILES
356	mkdir $(PKG_DIR)
357	cp -rf `cat __FILES | grep -v __FILES` $(PKG_DIR)
358	rm __FILES
359	find $(PKG_DIR) -name CVS -prune -exec rm -rf {} \;
360	cd $(PKG_DIR) ; $(TCLSH_PROG) PREPARE
361	-tar cf - $(PKG_DIR) | gzip --best > $(PKG_DIR).tar.gz
362	-tar cf - $(PKG_DIR) | bzip2 > $(PKG_DIR).tar.bz2
363	-zip -r $(PKG_DIR).zip $(PKG_DIR)
364	rm -rf $(PKG_DIR)
365
366#========================================================================
367# Definitions to build Pat's chantest code. An example on how to use
368# the memchan stub library.
369#========================================================================
370
371CHANTEST_OBJECTS=chantest.$(OBJEXT)
372CHANTEST_LIB_FILE=libChantest0.1.$(SHLIB_SUFFIX)
373
374chantest: binaries $(CHANTEST_LIB_FILE)
375
376$(CHANTEST_LIB_FILE): $(CHANTEST_OBJECTS)
377	-rm -f $@
378	$(SHLIB_LD) -o $@ $(CHANTEST_OBJECTS) $(SHLIB_LDFLAGS) \
379		$(SHLIB_LD_LIBS) $(PKG_STUB_LIB_FILE)
380	$(RANLIB) $@
381
382chantest.$(OBJEXT): chantest.c
383	$(COMPILE) -I$(srcdir)/generic -DUSE_MEMCHAN_STUBS=1 \
384		-c `@CYGPATH@ $<` -o $@
385
386#========================================================================
387# End of user-definable section
388#========================================================================
389
390#========================================================================
391# Don't modify the file to clean here.  Instead, set the "CLEANFILES"
392# variable in configure.in
393#========================================================================
394
395clean:
396	-test -z "$(BINARIES)" || rm -f $(BINARIES)
397	-rm -f *.$(OBJEXT) core *.core
398	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
399
400distclean: clean
401	-rm -f *.tab.c
402	-rm -f $(CONFIG_CLEAN_FILES)
403	-rm -f config.cache config.log config.status
404
405#========================================================================
406# Install binary object libraries.  On Windows this includes both .dll and
407# .lib files.  Because the .lib files are not explicitly listed anywhere,
408# we need to deduce their existence from the .dll file of the same name.
409# Library files go into the lib directory.
410# In addition, this will generate the pkgIndex.tcl
411# file in the install location (assuming it can find a usable tclsh shell)
412#
413# You should not have to modify this target.
414#========================================================================
415
416install-lib-binaries:
417	@mkdir -p $(DESTDIR)$(pkglibdir)
418	@list='$(lib_BINARIES)'; for p in $$list; do \
419	  if test -f $$p; then \
420	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
421	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(pkglibdir)/$$p; \
422	    chmod 755 $(DESTDIR)$(pkglibdir)/$$p; \
423	    stub=`echo $$p|sed -e "s/.*\(stub\).*/\1/"`; \
424	    if test "x$$stub" = "xstub"; then \
425		echo " $(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p"; \
426		$(RANLIB_STUB) $(DESTDIR)$(pkglibdir)/$$p; \
427	    else \
428		echo " $(RANLIB) $(DESTDIR)$(pkglibdir)/$$p"; \
429		$(RANLIB) $(DESTDIR)$(pkglibdir)/$$p; \
430	    fi; \
431	    ext=`echo $$p|sed -e "s/.*\.//"`; \
432	    if test "x$$ext" = "xdll"; then \
433		lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
434		if test -f $$lib; then \
435		    echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
436	            $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib; \
437		fi; \
438	    fi; \
439	  fi; \
440	done
441	@list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
442	  if test -f $(srcdir)/$$p; then \
443	    destp=`basename $$p`; \
444	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
445	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
446	  fi; \
447	done
448	@if test "x$(SHARED_BUILD)" = "x1"; then \
449	    echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \
450	    $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \
451	fi
452
453#========================================================================
454# Install binary executables (e.g. .exe files and dependent .dll files)
455# This is for files that must go in the bin directory (located next to
456# wish and tclsh), like dependent .dll files on Windows.
457#
458# You should not have to modify this target, except to define bin_BINARIES
459# above if necessary.
460#========================================================================
461
462install-bin-binaries:
463	@mkdir -p $(DESTDIR)$(bindir)
464	@list='$(bin_BINARIES)'; for p in $$list; do \
465	  if test -f $$p; then \
466	    echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
467	    $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p; \
468	  fi; \
469	done
470
471Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
472	cd $(top_builddir) \
473	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
474
475uninstall-binaries:
476	list='$(lib_BINARIES)'; for p in $$list; do \
477	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
478	done
479	list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
480	  p=`basename $$p`; \
481	  rm -f $(DESTDIR)$(pkglibdir)/$$p; \
482	done
483	list='$(bin_BINARIES)'; for p in $$list; do \
484	  rm -f $(DESTDIR)$(bindir)/$$p; \
485	done
486
487#========================================================================
488#
489# Target to regenerate header files and stub files from the *.decls tables.
490#
491#========================================================================
492
493genstubs:
494	$(TCLSH_PROG)	\
495		$(srcdir)/tools/genStubs.tcl $(srcdir)/generic	\
496		$(srcdir)/Memchan.decls
497
498#========================================================================
499#
500# Target to check that all exported functions have an entry in the stubs
501# tables.
502#
503#========================================================================
504
505Memchan_DECLS = \
506	$(srcdir)/buf.decls    \
507	$(srcdir)/bufInt.decls \
508	$(srcdir)/memchan.decls
509
510checkstubs:
511	-@for i in `nm -p $(Memchan_LIB_FILE) | awk '$$2 ~ /T/ { print $$3 }' \
512		| sort -n`; do \
513		match=0; \
514		for j in $(Memchan_DECLS); do \
515		    if [ `grep -c $$i $$j` -gt 0 ]; then \
516			match=1; \
517		    fi; \
518		done; \
519		if [ $$match -eq 0 ]; then echo $$i; fi \
520	done
521
522
523.PHONY: all binaries clean depend distclean doc install libraries test chantest
524
525# Tell versions [3.59,3.63) of GNU make to not export all variables.
526# Otherwise a system limit (for SysV at least) may be exceeded.
527.NOEXPORT:
528