scsh-users
[Top] [All Lists]

FIX for make problem

To: Bill Sommerfeld <sommerfeld@apollo.hp.com>
Subject: FIX for make problem
From: Brian D. Carlstrom <bdc@clark.lcs.mit.edu>
Date: Wed, 2 Nov 94 14:06:15 -0500
Cc: scsh-bugs@martigny.ai.mit.edu
Reply-to: bdc@ai.mit.edu

here is a new Makefile.in. reconfigure and it should work. if you just
want to make this one rul change in the Makefile, thats fine too:

scsh/scsh.image: $(SCHEME) $(CIG).image scsh/load-scsh.scm
        (echo ",translate =scheme48/ $(srcdir)/"; \
         cat scsh/load-scsh.scm; \
         echo ",translate =scheme48/ $(LIB)/") \
        | $(srcdir)/$(VM) -o $(srcdir)/$(VM) -i $(CIG).image \

-bri

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Scheme Shell Makefile
# Last updated October 1994 by BDC

# Documentation in files INSTALL and doc/install.txt

srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
DEFS = @DEFS@
LIBS = @LIBS@
CFLAGS = @CFLAGS@
CPPFLAGS= -I./cig -I./scsh/regexp
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

LDFLAGS = -g

prefix = /usr/local
exec_prefix = $(prefix)
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
incdir = $(exec_prefix)/include
mandir = $(prefix)/man
manext = 1

# 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) -c $(CPPFLAGS) $(DEFS) -I$(srcdir) $(CFLAGS) -o $@ $<

# You might want to change RUNNABLE to "s48" # NOT -bri
RUNNABLE = scsh
MANPAGE = $(RUNNABLE).$(manext)
LIB = $(libdir)/$(RUNNABLE)

distdir = /users/ftp/pub/s48
#distdir = /net/mini-wheats/fs/admin/ftp/pub/s48

# 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)/filenames.make
#
#NetBSD make wants to see this instead:
#.include "$(srcdir)/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 scheme48vm and/or scheme48.image.  But it
#    requires you to have squirreled away a previous working version
#    of scheme48.

BIG_HEAP = -h 4000000
LINKER_VM = ./$(VM) $(BIG_HEAP)
LINKER_RUNNABLE = $(LINKER_VM) -i $(IMAGE)
LINKER_IMAGE = link/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.

# Targets:

IMAGE = scheme48.image
INITIAL = $(srcdir)/initial.image
VM = scshvm
LIBCIG = cig/lib$(VM).a
CIG = cig/cig
CIGOBJS = cig/libcig.o cig/libcig1.o
SCSHVMHACKS = proc2.o # postgcstub.o
SCSHOBJS = scsh/dirstuff1.o scsh/fdports1.o scsh/rescm.o \
        scsh/syscalls.o scsh/syscalls1.o scsh/userinfo.o \
        scsh/stdio_dep.o \
        scsh/putenv.o \
        scsh/regexp/libregexp.a
DUMMY = scsh/time.o scsh/time1.o

OBJS = unix.o dynload.o prescheme.o extension.o scheme48vm.o \
        $(CIGOBJS) $(SCSHVMHACKS) $(SCSHOBJS) 

# Sources:

CONFIG_FILES = interfaces.scm low-packages.scm rts-packages.scm \
               comp-packages.scm

# Rules:

# The following is the first rule and therefore the "make" command's
# default target.
enough: $(VM) $(IMAGE) script $(LIBCIG) scsh $(MANPAGE) .notify

# The developers are curious to know.  Don't be concerned if this fails.
.notify: minor-version-number
        touch .notify
        -echo SCSH 0.`cat $(srcdir)/scsh/minor-version-number` \
           Scheme48 0.`cat $(srcdir)/minor-version-number` installation. \
           | mail scheme-48-notifications@martigny.ai.mit.edu 
        -echo Another scsh 0.`cat $(srcdir)/scsh/minor-version-number` \
        installation. | mail scsh-notifications@martigny.ai.mit.edu 

$(VM): main.o $(OBJS)
        $(CC) $(LDFLAGS) -o $@ main.o $(OBJS) $(LIBS)

$(LIBCIG): main.o $(OBJS)
        ld -r -o $@ main.o $(OBJS)

main.o: main.c
        $(CC) -c -o $@ -DDEFAULT_IMAGE_NAME=\"$(LIB)/scsh.image\" \
            $(CPPFLAGS) $(CFLAGS) $(srcdir)/main.c
scheme48vm.o: scheme48vm.c prescheme.h
extension.o: extension.c sysdep.h scheme48.h
unix.o: unix.c sysdep.h
dynload.o: dynload.c sysdep.h scheme48.h

# --------------------
# Make scheme48.image from initial.image and library .scm files.
#
# In the following, "make" passes $$USER to the shell as $USER, which
# the shell sees as an environment variable reference.
#
# For bootstrap reasons, initial.image is *not* listed as a source,
# even though it really is.

$(IMAGE): $(VM) env/init-defpackage.scm more-interfaces.scm link-packages.scm \
           more-packages.scm $(usual-files) initial.debug build-usual-image
        sh $(srcdir)/build-usual-image "$(srcdir)" "$(LIB)" "$(IMAGE)" \
           "$(VM)" "$(INITIAL)"

# Unix man page...

$(MANPAGE): scsh.man Makefile
        sed 's=LBIN=$(bindir)=g' $(srcdir)/scsh.man \
         | sed 's=LLIB=$(LIB)=g' \
         | sed 's=LSCSH=$(RUNNABLE)=g' >$@
        chmod +r $@

script:
        (echo '#!/bin/sh'; \
         echo exec '$(LIB)/$(VM)' -o '$(LIB)/$(VM)' -i '$(LIB)/$(IMAGE)' 
\"\$$\@\") \
           > script
        chmod +x script

### Fake targets:  all clean install man dist

install: install-libdir install-vm install-misc \
        install-man install-inc install-scsh

#install: script install-libdir install-vm install-image install-misc \
#       install-man install-inc install-cig install-scsh
#       This is now install-scsh
#       $(INSTALL_PROGRAM) script $(bindir)/$(RUNNABLE)

install-libdir:
        -mkdir -p $(LIB)

install-vm: $(VM)
        $(INSTALL_PROGRAM) $(VM) $(LIB)/

install-image: $(IMAGE)
        $(INSTALL_DATA) $(IMAGE) $(LIB)/

install-man: $(MANPAGE)
        if test -d $(mandir)/man$(manext);  \
          then $(INSTALL_DATA) $(MANPAGE) $(mandir)/man$(manext); \
          else echo "No man directory, not installing man page"; fi

install-inc: scheme48.h
        $(INSTALL_DATA) $(srcdir)/scheme48.h $(incdir)/

install-cig: cig
        -mkdir $(LIB)/cig
        $(INSTALL_PROGRAM) $(CIG) $(LIB)/cig
        $(INSTALL_PROGRAM) $(CIG).image $(LIB)/cig
        $(INSTALL_DATA) $(LIBCIG) $(LIB)/cig
        $(INSTALL_DATA) cig/libcig.h $(LIB)/cig

install-misc: $(LIB)/rts $(LIB)/env $(LIB)/big $(LIB)/opt \
              $(LIB)/misc $(LIB)/link
        for f in $(srcdir)/rts/*num.scm; \
            do $(INSTALL_DATA) $$f $(LIB)/rts/; done
        for f in $(srcdir)/env/*.scm; do $(INSTALL_DATA) $$f $(LIB)/env/; done
        for f in $(srcdir)/big/*.scm; do $(INSTALL_DATA) $$f $(LIB)/big/; done
        for f in $(srcdir)/opt/*.scm; do $(INSTALL_DATA) $$f $(LIB)/opt/; done
        for f in $(srcdir)/misc/*.scm; \
            do $(INSTALL_DATA) $$f $(LIB)/misc/; done
        for f in $(srcdir)/link/*.scm; \
            do $(INSTALL_DATA) $$f $(LIB)/link/; done
        $(INSTALL_DATA) $(srcdir)/rts/jar-defrecord.scm $(LIB)/rts/
#  -p: Intermediate directories are created as necessary.
$(LIB)/rts:
        mkdir -p $(LIB)/rts
$(LIB)/env:
        mkdir -p $(LIB)/env
$(LIB)/opt:
        mkdir -p $(LIB)/opt
$(LIB)/big:
        mkdir -p $(LIB)/big
$(LIB)/misc:
        mkdir -p $(LIB)/misc
$(LIB)/link:
        mkdir -p $(LIB)/link

configure: configure.in
        cd $(srcdir); autoconf

clean: clean-scsh
        -rm -f $(VM) *.o TAGS $(IMAGE) *.tmp script $(MANPAGE) \
            link/*.image debug/*.image debug/*.debug mini mini-heap.c \
            cig/*.o $(CIG) $(CIG).image $(LIBCIG)

distclean: clean
        rm -f Makefile sysdep.h config.status
     
man:    $(MANPAGE)

check:  $(VM) $(IMAGE) debug/check.scm
        (echo ,translate =scheme48/ $(srcdir)/; \
         echo ,config ,load $(srcdir)/debug/test.scm; \
         echo ,exec ,load $(srcdir)/debug/check.scm; echo ,exec "(done)") \
        | ./$(VM) -i $(IMAGE) -a batch

# --------------------
# 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:
        etags rts/*.scm bcomp/*.scm *.scm env/*.scm big/*.scm \
          link/*.scm opt/*.scm debug/*.scm misc/*.scm

# --------------------
# Increment the minor version number
inc:
        (cat minor-version-number; echo 1+p) | dc >minor-version-number.tmp
        mv minor-version-number.tmp minor-version-number
        echo \(define version-info \"0.`cat minor-version-number`\"\) \
          >env/version-info.scm


# --------------------
# Generate 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 the forms in filenames.scm to 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=packages.scm rts-packages.scm alt-packages.scm \
                comp-packages.scm initial-packages.scm link-packages.scm \
                more-packages.scm filenames.scm

filenames.make: $(PACKAGES)
        $(MAKE) $(VM) PACKAGES=
        ./$(VM) -i $(INITIAL) -a batch <filenames.scm
# or:   $(RUNNABLE) -a batch <filenames.scm

# --------------------
# Static linker
#
# The linker is capable of rebuilding an image from sources, even
# across an incompatible change in VM data representations.

link/linker.image: $(linker-files) alt/init-defpackage.scm
        (echo ,batch; echo ,bench on;                  \
         echo ,open signals handle features;           \
         echo ,open bitwise ascii code-vectors record; \
         echo ,load $(linker-files);                   \
         echo ,load alt/init-defpackage.scm;           \
         echo ,dump link/linker.image)                 \
        | $(LINKER_RUNNABLE)

# Or, to bootstrap from Lucid Common Lisp: (last tested with
# Pseudoscheme 2.9 and Scheme 48 version 0.19)

PSEUDODIR = ../pseudo

link/linker-in-lucid: link/lucid-script.lisp $(linker-files) \
            alt/pseudoscheme-features.scm alt/pseudoscheme-record.scm
        (echo \(defvar pseudoscheme-directory \"$(PSEUDODIR)/\"\); \
         cat link/lucid-script.lisp; \
         echo \(dump-linker\) \(lcl:quit\)) \
        | lisp

# --------------------
# Initial image
#
# The initial.image is built by the static linker.  The image contains
# Scheme, the byte-code compiler, and a minimal command processor, but
# no debugging environment to speak of.

$(INITIAL): $(LINKER_IMAGE) $(CONFIG_FILES) initial.scm $(initial-files)
        ($(START_LINKER)               \
         echo \(load-configuration \"interfaces.scm\"\); \
         echo \(load-configuration \"packages.scm\"\); \
         echo \(flatload initial-structures\); \
         echo \(load \"initial.scm\"\);  \
         echo \(link-initial-system\))   \
        | $(LINKER)

# --------------------
# Various small images for debugging low-level changes

LOAD_DEBUG = \
         $(START_LINKER) \
         echo \(load-configuration \"interfaces.scm\"\); \
         echo \(load-configuration \"packages.scm\"\); \
         echo \(flatload debug-structures\)

debug/tiny.image: $(LINKER_IMAGE) debug/tiny-packages.scm debug/tiny.scm
        ($(START_LINKER) \
         echo \(load-configuration \"debug/tiny-packages.scm\"\); \
         echo \(link-simple-system \'\(debug tiny\) \'start tiny-system\)) \
        | $(LINKER)

debug/little.image: $(LINKER_IMAGE) $(CONFIG_FILES) debug-packages.scm
        ($(LOAD_DEBUG); echo \(link-little-system\)) \
        | time $(LINKER)

debug/mini.image: $(LINKER_IMAGE) $(CONFIG_FILES)
        ($(LOAD_DEBUG); echo \(link-mini-system\)) \
        | $(LINKER)

debug/medium.image: $(LINKER_IMAGE) $(CONFIG_FILES)
        ($(LOAD_DEBUG); echo \(flatload compiler-structures\); \
         echo \(link-medium-system\)) \
        | $(LINKER)

smain.o: main.c
        $(CC) -c $(CPPFLAGS) $(CFLAGS) -DSTATIC_AREAS -o $@ $(srcdir)/main.c

mini: mini-heap.o smain.o
        $(CC) $(LDFLAGS) -o $@ smain.o mini-heap.o $(OBJS) $(LIBS)
mini-heap.o: mini-heap.c
        $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $(srcdir)/mini-heap.c
mini-heap.c: debug/mini1.image
        (echo ,exec ,load misc/load-static.scm; \
         echo \(do-it 150000 \"$(srcdir)/debug/mini1.image\" \"$@\"\)) \
        | $(RUNNABLE) -h 3000000 -a batch
debug/mini1.image: $(VM) debug/mini.image
        echo "(write-image \"debug/mini1.image\" \
                           (usual-resumer (lambda (args) \
                                            (command-processor #f args))) \
                           \"foo\")" \
        | ./$(VM) -i debug/mini.image -a batch


# --------------------
# Generate scheme48.h from VM sources

scheme48.h: vm/arch.scm vm/data.scm link/generate-c-header.scm
        (echo ,bench; \
         echo ,load-package big-scheme; echo ,open big-scheme; \
         echo ,load link/generate-c-header.scm; \
         echo \(make-c-header-file \"$@\" \
                                   \"$(srcdir)/vm/arch.scm\" 
\"$(srcdir)/vm/data.scm\"\)) \
        | $(RUNNABLE) -a batch

#scheme48vm.c: $(vm-files)
#       prescheme $(srcdir)/vm/compile-vm

cig: $(CIG) $(CIG).image

# First, build an image to do cig processing,
# and put it in /tmp:
# echo ",config ,load packages-plus.scm"; \     
#Insert a #! trigger:
# Make it executable: 
# Flush the temp file:
$(CIG): cig/cig.scm cig/libcig.scm # $(srcdir)/$(INITIAL)
        gensym=$$$$
        (echo ",batch"; \
         echo ",flush"; \
         echo ",flush maps source names files table"; \
         echo ",translate =scheme48/ $(srcdir)/"; \
         echo ",config ,load cig/cig.scm"; \
         echo ",config ,load cig/libcig.scm"; \
         echo ",load-package cig-standalone"; \
         echo ",flush"; echo ",flush maps source names files table"; \
         echo ",in cig-standalone"; \
         echo ",translate =scheme48/ $(LIB)/"; \
         echo ",build cig-standalone-toplevel /tmp/cig.$$gensym") \
        | $(srcdir)/$(VM) -i $(srcdir)/$(IMAGE)
        cig/image2script $(LIB)/$(VM) </tmp/cig.$$gensym > $(CIG)
        chmod +x $(CIG)
        rm -f /tmp/cig.$$gensym

# First, build an image to do cig processing,
# and put it in /tmp:
# echo ",config ,load packages-plus.scm"; \     
#Insert a #! trigger:
# Make it executable: 
# Flush the temp file:
$(CIG).image: cig/cig.scm cig/libcig.scm # $(srcdir)/$(INITIAL)
        gensym=$$$$
        (echo ",batch"; \
         echo ",translate =scheme48/ $(srcdir)/"; \
         echo ",config ,load cig/cig.scm"; \
         echo ",config ,load cig/libcig.scm"; \
         echo ",load-package cig-aux"; \
         echo ",open define-foreign-syntax"; \
         echo ",translate =scheme48/ $(LIB)/"; \
         echo ",dump /tmp/cig.$$gensym \"(CIG Preloaded -bri)\"") \
        | $(srcdir)/$(VM) -o $(srcdir)/$(VM) -i $(srcdir)/$(IMAGE)
        cig/image2script $(LIB)/$(VM) \
                        -o $(LIB)/$(VM) \
                        </tmp/cig.$$gensym > $(CIG).image
        chmod +x $(CIG).image
        rm -f /tmp/cig.$$gensym

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# SCSH Specifics
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
scsh: scsh/scsh scsh/scsh.image

SCHEME =scsh/defrec.scm scsh/fdports.scm scsh/fileinfo.scm \
        scsh/filemtch.scm scsh/filesys.scm scsh/fname.scm \
        scsh/glob.scm scsh/load-scsh.scm scsh/newports.scm \
        scsh/rw.scm scsh/scsh-condition.scm \
        scsh/scsh-interfaces.scm scsh/scsh-package.scm \
        scsh/scsh.scm scsh/stringcoll.scm scsh/syntax-helpers.scm \
        scsh/syntax.scm scsh/syscalls.scm scsh/top.scm \
        scsh/utilities.scm scsh/wait.scm scsh/signals.scm \
        scsh/fdflags.scm scsh/errno.scm # scsh/time.scm

syscalls.c: syscalls.scm $(CIG)
        ./scshvm -o ./scshvm -i ./cig/cig.image < $< > syscalls.c

scsh/scsh: scsh/scsh.c
        $(CC) -o $@ \
        -DVM=\"$(LIB)/$(VM)\" \
        -DIMAGE=\"$(LIB)/scsh.image\" \
        scsh/scsh.c

scsh/scsh.image: $(SCHEME) $(CIG).image scsh/load-scsh.scm
        (echo ",translate =scheme48/ $(srcdir)/"; \
         cat scsh/load-scsh.scm; \
         echo ",translate =scheme48/ $(LIB)/") \
        | $(srcdir)/$(VM) -o $(srcdir)/$(VM) -i $(CIG).image \

#scsh/scsh.runnable: scsh/scsh.image
#       cig/image2script $(LIB)/$(VM) -o $(LIB)/$(VM) -h 1800000 \
#           < scsh/scsh.image > $@
#       chmod +x $@

scsh/regexp/libregexp.a:
        cd scsh/regexp; $(MAKE)

# doesnt work -bri
#scsh/scsh-heap.c: scsh/scsh.image
#       (echo ,exec ,load misc/load-static.scm; \
#        echo \(do-it 3000000 \"$(srcdir)/scsh/scsh.image\" \"$@\"\)) \
#       | $(VM) -h 6000000 -o $(VM) -i scsh/scsh.image  -a batch

install-scsh:
        $(INSTALL_PROGRAM) scsh/scsh.image $(LIB)/scsh.image
        $(INSTALL_PROGRAM) scsh/scsh $(LIB)/$(RUNNABLE)
        rm -f $(bindir)/$(RUNNABLE)
        ln -s $(LIB)/$(RUNNABLE) $(bindir)/$(RUNNABLE)

clean-scsh:
        -rm -f scsh/*.o scsh/regexp/*.o scsh/*.image scsh/scsh
        -cd scsh/regexp; $(MAKE) clean

<Prev in Thread] Current Thread [Next in Thread>