SUBDIRS=m s

LIBS=@LIBS@ -lm

bin_PROGRAMS=scm
EXTRA_PROGRAMS=pi
pkgdata_DATA=COPYING Iedline.scm Init5c3.scm Transcen.scm
man_MANS=scm.1
info_TEXINFOS=scm.texi

scm_SOURCES=continue.c eval.c findexec.c repl.c rope.c scl.c scm.c \
	script.c subr.c sys.c time.c unif.c gmalloc.c base64.c

pi_SOURCES=pi.c

EXTRA_scm_SOURCES=crs.c dynl.c ecrt0.c edline.c gmalloc.c gsubr.c ioext.c \
	mak0strfrom.c posix.c pre-crt0.c ramap.c record.c regex.c rgx.c \
	savant-linkage.c sc2.c sock-ext.c socket.c tcp.c unix.c \
	cryptscm.c cryptfile.c savant-linkage.c ssleay-linkage.c udp.c

scm.o: scm.c
	$(COMPILE) -DINITS="$(INITS)" -c scm.c -o scm.o

scm_LDADD=$(XOBJ)
scm_DEPENDENCIES=$(XOBJ) $(UNEXEC)
scm_LDFLAGS=$(UNEXEC) # It wants to be first on some platforms....

EXTRA_DIST=ANNOUNCE Iedline.scm Init5c3.scm Link.scm Macro.scm QUICKREF README \
	README.unix Transcen.scm bench.scm build.bat build.scm continue.h \
	getpagesize.h mkimpcat.scm patchlvl.h pi.scm r4rstest.scm regex.h \
	require.scm scm.1 scm.doc scm.h scmfig.h scmflags.h setjump.h \
	setjump.mar setjump.s split.scm tcp.h unexaix.c unexalpha.c \
	unexapollo.c unexconvex.c unexec.c unexelf.c unexelf1.c unexencap.c \
	unexenix.c unexfx2800.c unexhp9k800.c unexmips.c unexnext.c unexnt.c \
	unexsgi.c unexsni.c unexsunos4.c

# If this line gives you trouble in some non-GNU Make, just comment it out.
# It's only there for building a Purify-instrumented binary, and should only
# be used if you do "make pure".
scm_PURE_OBJECTS = $(shell echo "$(scm_OBJECTS)" | sed -e s/gmalloc\.o//)

pure: scm.pure

scm.pure: $(scm_PURE_OBJECTS) $(scm_DEPENDENCIES)
	@rm -f scm.pure
	purify $(LINK) $(scm_LDFLAGS) $(scm_PURE_OBJECTS) $(scm_LDADD) $(LIBS)
