# Scsh Makefile # Documentation in files INSTALL and doc/install.txt SHELL = /bin/sh ### Filled in by `configure' ### srcdir = @srcdir@ VPATH = @srcdir@ CC = @CC@ DEFS = @DEFS@ LIBS = @LIBS@ CFLAGS = @CFLAGS@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ LDFLAGS = -g @LDFLAGS@ LIBOBJS = @LIBOBJS@ RM = rm -f AR = @AR@ RANLIB = @RANLIB@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ incdir = @includedir@ manext = 1 mandir = @mandir@/man$(manext) ### End of `configure' section### htmldir = $(libdir)/scsh/doc/scsh-manual/html # HP 9000 series, if you don't have gcc # CC = cc # CFLAGS = -Aa -O +Obb1800 # DEFS = -D_HPUX_SOURCE -Dhpux # Ultrix # LDFLAGS = -N .c.o: $(CC) -g -c $(DEFS) -I$(srcdir)/c $(CPPFLAGS) $(CFLAGS) -o $@ $< # BUILD_RUNNABLE has to be Scheme 48 0.53. This is used for builds directly # out of the CVS repository. # We cannot use Scsh here since -i is not understood. BUILD_RUNNABLE = /afs/wsi/i386_fbsd32/bin/scheme48 RUNNABLE = scsh MANPAGE = $(RUNNABLE).$(manext) LIB = $(libdir)/$(RUNNABLE) distdir = /tmp # If make barfs on this include line, just comment it out. It's only # really needed if you want to build the linker or rebuild initial.image. include $(srcdir)/build/filenames.make # #NetBSD make wants to see this instead: #.include "$(srcdir)/build/filenames.make" # Static linker: # # You only need the linker if you're going to make changes to the # things that go into the initial.image, which in general means the # files in rts/. If you decide you need to use the linker, then you # gots your choice; it can run in just about any version of Scheme 48 # or Pseudoscheme. (It has also been made to run in Scheme->C.) It # doesn't matter a whole lot which Scheme you use as long as it's not # broken or unavailable. The two best choices are: # 1. As below: build the linker on the scheme48vm and scheme48.image # that are in the current directory. # 2. LINKER_VM = $(RUNNABLE) $(BIG_HEAP) # LINKER_RUNNABLE = $(RUNNABLE) # These settings requires you to already have a $(RUNNABLE) # command. This is desirable if you are making changes to the # system that might break scshvm and/or scsh/scsh.image. But it # requires you to have squirreled away a previous working version # of scsh. BIG_HEAP = -h 5500000 # 1. is broken if you build from CVS # LINKER_VM = ./$(VM) $(BIG_HEAP) # LINKER_RUNNABLE = $(LINKER_VM) -i $(IMAGE) # therefore according to 2. but we cannot use scsh since -i is not understood LINKER_VM = $(BUILD_RUNNABLE) $(BIG_HEAP) LINKER_RUNNABLE = $(BUILD_RUNNABLE) LINKER_IMAGE = build/linker.image LINKER = $(LINKER_VM) -i $(LINKER_IMAGE) START_LINKER = echo ',batch' && echo ',bench on' # -------------------- # You shouldn't have to change anything below this point, except for possibly # the external code rules. # Targets: IMAGE = scheme48.image INITIAL = build/initial.image VM = scshvm #scsh-lib LIBSCSHVM = scsh/lib$(VM).a LIBSCSH = scsh/libscsh.a SCSHVMHACKS = scsh/proc2.o # # SCSHOBJS = \ scsh/cstuff.o \ scsh/dirstuff1.o \ scsh/fdports1.o \ scsh/flock1.o \ scsh/signals1.o \ scsh/machine/libansi.o \ scsh/network1.o \ scsh/putenv.o \ scsh/rx/regexp1.o \ scsh/sleep1.o \ scsh/syscalls1.o \ scsh/syslog1.o \ scsh/time1.o \ scsh/tty1.o \ scsh/userinfo1.o \ scsh/sighandlers1.o \ scsh/libscsh.o \ scsh/md5.o SCSH_INITIALIZERS = s48_init_syslog s48_init_posix_regexp \ s48_init_userinfo s48_init_sighandlers \ s48_init_syscalls s48_init_network s48_init_flock \ s48_init_dirstuff s48_init_time s48_init_tty \ s48_init_libscsh s48_init_md5 UNIX_OBJS = c/unix/misc.o c/unix/io.o c/unix/fd-io.o c/unix/event.o SRFI_OBJS = c/srfi/srfi-27.o SRFI_INITIALIZERS = s48_init_srfi_27 S48OBJS = c/scheme48vm.o c/scheme48heap.o c/extension.o c/external.o OBJS = scsh/process_args.o c/init.o $(S48OBJS) $(SCSHOBJS) \ $(SCSHVMHACKS) $(SRFI_OBJS) FAKEHS = c/fake/dlfcn.h c/fake/sigact.h c/fake/strerror.h \ c/fake/sys-select.h # Sources: CONFIG_FILES = scheme/interfaces.scm scheme/low-packages.scm \ scheme/rts-packages.scm scheme/comp-packages.scm # Rules: # The following is the first rule and therefore the "make" command's # default target. enough: $(VM) $(IMAGE) go scsh $(LIBSCSH) $(LIBSCSHVM) # -------------------- # External code to include in the VM # After changing any of these you should delete `scheme48vm' and remake it. EXTERNAL_OBJECTS = $(SOCKET_OBJECTS) $(LOOKUP_OBJECTS) EXTERNAL_FLAGS = $(SOCKET_FLAGS) EXTERNAL_INITIALIZERS = $(ADDITIONAL_INITIALIZER) $(SOCKET_INITIALIZERS) \ $(LOOKUP_INITIALIZERS) \ $(SCSH_INITIALIZERS) $(SRFI_INITIALIZERS) \ # Rules for any external code. # Socket rules c/unix/socket.o: c/scheme48.h c/fd-io.h c/event.h SOCKET_OBJECTS = c/unix/socket.o SOCKET_LD_FLAGS = SOCKET_INITIALIZERS = s48_init_socket # End of socket rules # Lookup rules (this is just for compatibility with old code) c/unix/dynamo.o: c/scheme48.h LOOKUP_OBJECTS = c/unix/dynamo.o LOOKUP_INITIALIZERS = s48_init_external_lookup # End of lookup rules # Initializer for s48_add_external_init ADDITIONAL_INITIALIZER = s48_init_additional_inits # End of external rules # -------------------- # The developers are curious to know. Don't be concerned if this fails. .notify: build/minor-version-number touch .notify -echo SCSH 0.`cat $(srcdir)/scsh/minor-version-number` \ Scheme48 0.`cat $(srcdir)/minor-version-number` infestation. \ | mail scheme-48-notifications@zurich.ai.mit.edu -echo Another scsh 0.`cat $(srcdir)/scsh/minor-version-number` \ infestation. | mail scsh-notifications@zurich.ai.mit.edu # These .h files mediate between the code exported from foo1.c # and imported into foo.scm's stub foo.c. scsh/dirstuff1.o: scsh/dirstuff1.h scsh/userinfo1.o: scsh/userinfo1.h scsh/network1o: scsh/network1.h scsh/flock1.o: scsh/flock1.h scsh/fdports1.o scsh/fdports.o: scsh/fdports1.h scsh/rx/regexp1.o: c/scheme48.h scsh/sighandlers1.o: scsh/sighandlers1.h scsh/syslog1.o: c/scheme48.h include $(srcdir)/scsh/machine/Makefile.inc # Berkeley make wants to see this instead: (or use GNU make on BSD. -bri) #.include "$(srcdir)/scsh/machine/Makefile.inc" $(VM): c/main.o $(OBJS) $(UNIX_OBJS) $(LIBOBJS) $(EXTERNAL_OBJECTS) rm -f /tmp/s48_external_$$$$.c && \ build/build-external-modules /tmp/s48_external_$$$$.c \ $(EXTERNAL_INITIALIZERS) && \ $(CC) $(LDFLAGS) $(CFLAGS) -o $@ c/main.o $(OBJS) $(UNIX_OBJS) \ /tmp/s48_external_$$$$.c \ $(EXTERNAL_OBJECTS) $(EXTERNAL_LD_FLAGS) \ $(LIBOBJS) $(LIBS) && \ rm -f /tmp/s48_external_$$$$.c $(LIBSCSHVM): c/smain.o $(OBJS) $(RM) $@ $(AR) $@ c/smain.o $(OBJS) $(RANLIB) $@ $(LIBSCSH): $(OBJS) $(UNIX_OBJS) $(LIBOBJS) $(EXTERNAL_OBJECTS) $(RM) $@ \ rm -f /tmp/s48_external_$$$$.c && \ build/build-external-modules /tmp/s48_external_$$$$.c \ $(EXTERNAL_INITIALIZERS) && \ $(CC) -c $(CFLAGS) -o /tmp/s48_external_$$$$.o \ /tmp/s48_external_$$$$.c && \ $(AR) $@ $(OBJS) $(UNIX_OBJS) $(LIBOBJS) $(EXTERNAL_OBJECTS) \ /tmp/s48_external_$$$$.o && \ $(RANLIB) $@ && \ rm -f /tmp/s48_external_$$$$.c /tmp/s48_external_$$$$.o c/main.o: c/main.c $(CC) -c $(CFLAGS) -o $@ \ -DDEFAULT_IMAGE_NAME=\"$(LIB)/$(IMAGE)\" \ $(CPPFLAGS) $(DEFS) c/main.c c/init.o: c/init.c c/scheme48vm.h c/scheme48heap.h $(CC) -c $(CFLAGS) -o $@ \ -DDEFAULT_IMAGE_NAME=\"$(LIB)/$(IMAGE)\" \ $(CPPFLAGS) $(DEFS) c/init.c c/scheme48vm.o: c/prescheme.h c/scheme48vm.h c/scheme48heap.h c/event.h \ c/io.h c/fd-io.h c/scheme48vm-prelude.h c/scheme48heap.o: c/prescheme.h c/scheme48vm.h c/scheme48heap.h c/event.h \ c/io.h c/fd-io.h c/extension.o: c/sysdep.h $(FAKEHS) c/scheme48.h c/scheme48vm.h c/external.o: c/sysdep.h $(FAKEHS) c/scheme48.h c/unix/event.o: c/sysdep.h $(FAKEHS) c/scheme48vm.h c/scheme48heap.h \ c/event.h c/fd-io.h c/unix/fd-io.o: c/sysdep.h $(FAKEHS) c/scheme48vm.h c/scheme48heap.h \ c/event.h c/fd-io.h c/unix/misc.o: c/sysdep.h $(FAKEHS) c/unix/io.o: c/io.h c/fake/libdl1.o: c/fake/dlfcn.h c/fake/libdl2.o: c/fake/dlfcn.h c/fake/strerror.o: c/fake/strerror.h # -------------------- # Make scheme48.image from initial.image and library .scm files. # # For bootstrap reasons, initial.image is *not* listed as a source, # even though it really is. $(IMAGE): $(VM) scheme/env/init-defpackage.scm scheme/more-interfaces.scm \ scheme/link-packages.scm scheme/more-packages.scm \ $(usual-files) build/initial.debug build/build-usual-image build/build-usual-image . "`pwd`/scheme" '$(IMAGE)' './$(VM)' \ '$(INITIAL)' ### Fake targets: all clean install man dist install: enough dirs inst-script inst-vm inst-misc inst-man inst-inc \ inst-doc install-scsh inst-vm: $(VM) $(INSTALL_PROGRAM) $(VM) $(LIB) inst-man: if [ -d $(mandir) -a -w $(mandir) ]; then \ sed 's=LBIN=$(bindir)=g' doc/scsh.man | \ sed 's=LLIB=$(LIB)=g' | \ sed 's=LSCSH=$(RUNNABLE)=g' >$(MANPAGE) && \ $(INSTALL_DATA) $(MANPAGE) $(mandir) && \ $(RM) $(MANPAGE); \ else \ echo "$(mandir) not writable dir, not installing man page" \ >&2; \ fi inst-inc: $(INSTALL_DATA) $(srcdir)/c/scheme48.h $(incdir) $(INSTALL_DATA) $(srcdir)/c/write-barrier.h $(incdir) inst-misc: for stub in env big opt misc link srfi; do \ for f in scheme/$$stub/*.scm; do \ $(INSTALL_DATA) $$f $(LIB)/$$stub || exit 1; \ done; \ done && \ for f in scheme/rts/*num.scm scheme/rts/jar-defrecord.scm; do \ $(INSTALL_DATA) $$f $(LIB)/rts || exit 1; \ done inst-doc: for f in $(srcdir)/doc/*.txt $(srcdir)/doc/*.ps; do \ $(INSTALL_DATA) $$f $(LIB)/doc/; \ done && \ for f in $(srcdir)/doc/src/*.tex \ $(srcdir)/doc/src/*.dvi \ $(srcdir)/doc/src/*.ps; \ do $(INSTALL_DATA) $$f $(LIB)/doc/s48-manual/; \ done && \ for f in $(srcdir)/doc/src/manual/*.html; \ do $(INSTALL_DATA) $$f $(LIB)/doc/s48-manual/html/; \ done && \ for f in $(srcdir)/doc/scsh-manual/*.tex \ $(srcdir)/doc/scsh-manual/*.sty \ $(srcdir)/doc/scsh-manual/*.dvi \ $(srcdir)/doc/scsh-manual/*.ps \ $(srcdir)/doc/scsh-manual/*.pdf; \ do $(INSTALL_DATA) $$f $(LIB)/doc/scsh-manual/; \ done && \ for f in $(srcdir)/doc/scsh-manual/html/*.html \ $(srcdir)/doc/scsh-manual/html/*.gif \ $(srcdir)/doc/scsh-manual/html/*.css; \ do $(INSTALL_DATA) $$f $(htmldir)/; \ done && \ for f in $(srcdir)/doc/scsh-paper/*.tex \ $(srcdir)/doc/scsh-paper/*.sty \ $(srcdir)/doc/scsh-paper/*.dvi \ $(srcdir)/doc/scsh-paper/*.ps; \ do $(INSTALL_DATA) $$f $(LIB)/doc/scsh-paper/; \ done && \ for f in $(srcdir)/doc/scsh-paper/html/*.html \ $(srcdir)/doc/scsh-paper/html/*.css; \ do $(INSTALL_DATA) $$f $(LIB)/doc/scsh-paper/html; \ done inst-script: script=$(bindir)/$(RUNNABLE) && \ echo '#!/bin/sh' >$$script && \ echo >>$$script && \ echo 'lib=$(LIB)' >>$$script && \ echo 'exec $$lib/$(VM) -o $$lib/$(VM) -i $$lib/$(IMAGE) "$$@"' \ >>$$script && \ chmod +x $$script # Script to run scsh in this directory. go: echo '#!/bin/sh' >$@ && \ echo >>$@ && \ echo "lib=`pwd`" >>$@ && \ echo 'exec $$lib/$(VM) -o $$lib/$(VM) -i $$lib/scsh/scsh.image "$$@"' \ >>$@ && \ chmod +x $@ dirs: for dir in $(libdir) $(bindir) $(incdir) $(LIB) $(mandir) $(htmldir); do\ { mkdir -p $$dir && [ -w $$dir ]; } || { \ echo "$$dir not a writable directory" >&2; \ exit 1; \ } \ done && \ for dir in \ rts env big opt misc link srfi scsh doc/scsh-manual \ doc/s48-manual/html doc/scsh-paper/html ; do \ { mkdir -p $(LIB)/$$dir && [ -w $(LIB)/$$dir ]; } || { \ echo "$(LIB)/$$dir not a writable directory" >&2; \ exit 1; \ }; \ done configure: configure.in autoheader && autoconf clean: clean-scsh -rm -f $(VM) *.o c/*/*.o c/*.o \ $(IMAGE) \ build/*.tmp $(MANPAGE) build/linker.image \ scheme/debug/*.image scheme/debug/*.debug \ scheme/vm/scheme48vm.c scheme/vm/scheme48heap.c \ go $(distname) distclean: clean rm -f Makefile config.log config.status c/sysdep.h config.cache \ scsh/machine \ scsh/endian.scm \ exportlist.aix $(RM) a.exe $(VM).base $(VM).def $(VM).exp -find . -name '*~' -o -name '#*' -o -name core -exec rm {} \; check: $(VM) $(IMAGE) scheme/debug/check.scm ( \ echo ',batch'; \ echo ',translate =scheme48 scheme'; \ echo ',config ,load scheme/debug/test.scm'; \ echo ',exec ,load scheme/debug/check.scm'; \ echo ',exec (done)' \ ) | ./$(VM) -i $(IMAGE) # -------------------- # Rules from here on down are not essential for the basic installation # procedure, and are not expected to work when srcdir is not the # distribution directory. all: vm linker $(MAKE) image vm: $(VM) linker: $(LINKER_IMAGE) image: $(INITIAL) $(MAKE) $(IMAGE) tags: find . -name "*.scm" -o -name "*.c" -o -name "*.h" | etags - # -------------------- # Distribution... # DISTFILES should include all sources. DISTFILES = README COPYING INSTALL RELEASE configure config.sub config.guess \ scsh-config.in configure.in Makefile.in install-sh \ doc/*.ps doc/*.txt \ doc/src/*.tex doc/src/*.sty doc/src/manual.dvi \ doc/src/manual.ps \ emacs/README build/*-version-number build/*.exec \ build/*.lisp build/build-usual-image build/filenames.make \ build/filenames.scm build/initial.debug \ build/initial.image build/initial.scm \ build/build-external-modules \ c/*.[ch] c/*/*.[ch] c/scheme48.h.in \ emacs/*.el gdbinit \ scheme/*.scm scheme/*/*.scm \ ps-compiler/*.scm ps-compiler/minor-version-number \ ps-compiler/doc/*.txt ps-compiler/*/*.scm \ ps-compiler/*/*/*.scm \ ps-compiler/prescheme/test/fact.cps \ ps-compiler/prescheme/test/prescheme.h \ ps-compiler/prescheme/c-stuff \ c/sysdep.h.in \ scsh/*.scm scsh/*/*.scm \ scsh/*.[ch] scsh/*/*.[ch] \ scsh/*.scm.in scsh/*/Makefile.inc \ doc/scsh.man \ doc/scsh-manual/*.tex doc/scsh-manual/*.sty \ doc/scsh-manual/man.ps doc/scsh-manual/man.pdf \ doc/scsh-manual/man.dvi doc/scsh-manual/Makefile \ doc/scsh-manual/THANKS doc/scsh-manual/html/*.html \ doc/scsh-manual/html/*.gif doc/scsh-manual/html/*.css \ doc/src/manual/*.html \ doc/scsh-paper/*.sty doc/scsh-paper/*.tex \ doc/scsh-paper/mitlogo.ps doc/scsh-paper/scsh-paper.ps \ doc/scsh-paper/scsh-paper.dvi \ doc/scsh-paper/html/*.html doc/scsh-paper/html/*.css distname = $(RUNNABLE)-0.`cat build/minor-version-number` dist: build/initial.image (cd doc/src && latex manual.tex && latex manual.tex && \ dvips manual -o manual.ps && hyperlatex manual.tex) && \ (cd doc/scsh-manual && makeindex man && make man.ps && \ make man.pdf && make html) && \ (cd doc/scsh-paper && make scsh-paper.ps && make html) && \ distname=$(distname) && \ distfile=$(distdir)/$$distname.tar.gz && \ if [ -d $(distdir) ] && \ [ -w $$distfile -o -w $(distdir) ]; then \ rm -f $$distname && \ ln -s . $$distname && \ files='' && \ for i in $(DISTFILES); do \ if [ "$$i" != "c/sysdep.h" ]; then \ files="$$files $$distname/$$i"; \ fi \ done && \ tar -cf - $$files | \ gzip --best >$$distfile && \ rm $$distname; \ else \ echo "Can't write $$distfile" >&2; \ exit 1; \ fi && \ echo "Hope you already called ./autogen..." # Increment the minor version number inc: f=build/minor-version-number && \ expr `cat $$f` + 1 >$$f.tmp && \ mv $$f.tmp $$f && \ echo '(define version-info "0.'`cat $$f`'")' \ >scheme/env/version-info.scm # -------------------- # Generate build/filenames.make from *packages.scm # # This hack traces the module dependencies described in the # various configuration files and converts them into dependency lists # that "make" can use for its purposes. # # Since the distribution comes with a filenames.make, this rule # shouldn't be invoked for simple installations. But it will be used # if you change any of the *-packages.scm files. # # You can actually run the forms in filenames.scm in any Scheme # implementation that has syntax-rules and explicit-renaming low-level # macros (e.g., most versions of Scheme 48 and Pseudoscheme). # If there are errors running this script, and you need to debug, # don't use the initial.image, use something that has a reasonable # environment. # # If this fails and you don't feel like debugging or fixing the problem, # try "touch filenames.make" and hope for the best. PACKAGES=scheme/packages.scm scheme/rts-packages.scm scheme/alt-packages.scm \ scheme/comp-packages.scm scheme/initial-packages.scm \ scheme/link-packages.scm scheme/more-packages.scm \ build/filenames.scm build/filenames.make: $(PACKAGES) $(BUILD_RUNNABLE) -a batch 0k # ,flush names => -= 17k # ,flush maps => -= 350K # ,flush source => -= 1117k # ,flush => 550k scsh/stripped-scsh.image: $(VM) $(SCHEME) $(IMAGE) (echo ",flush maps source";\ echo ",translate =scheme48/ `pwd`/scheme/"; \ echo ",batch on"; \ echo ",config ,load $(loads)"; \ echo ",open $(opens)"; \ echo ",flush"; \ echo "(dump-scsh \"$@\")";) \ | ./$(VM) -o ./$(VM) -i $(IMAGE) -h 10000000 install-scsh: scsh install-scsh-image install-stripped-scsh-image $(RM) $(bindir)/$(RUNNABLE) $(INSTALL_PROGRAM) $(srcdir)/scsh/scsh $(bindir)/$(RUNNABLE) $(INSTALL_PROGRAM) $(srcdir)/$(LIBSCSHVM) $(libdir)/$(LIBSCSHVM) $(INSTALL_PROGRAM) $(srcdir)/$(LIBSCSH) $(libdir)/$(LIBSCSH) $(RANLIB) $(libdir)/$(LIBSCSH) for f in $(srcdir)/scsh/*.scm $(srcdir)/scsh/*/*.scm; \ do $(INSTALL_DATA) $$f $(LIB)/scsh/; done install-scsh-image: $(VM) scsh/scsh.image ( echo ',translate =scheme48 $(LIB)'; \ echo '(dump-scsh "$(LIB)/scsh.image")'; \ echo ',exit'; \ ) | ./$(VM) -i scsh/scsh.image install-stripped-scsh-image: $(VM) scsh/stripped-scsh.image ( echo ',translate =scheme48 $(LIB)'; \ echo '(dump-scsh "$(LIB)/stripped-scsh.image")'; \ echo ',exit'; \ ) | ./$(VM) -i scsh/stripped-scsh.image clean-scsh: $(RM) scsh/*.o scsh/rx/*.o scsh/machine/*.o $(RM) scsh/*.image $(RM) $(LIBSCSHVM) $(LIBSCSH) scsh/scsh$(EXEEXT)