[Simh] simH on slackware (or most linux for that matter).

Peter Lund firefly at vax64.dk
Tue Oct 2 15:01:19 EDT 2007


On Mon, 2007-10-01 at 12:02 -0600, Brett Bump wrote:

> I guess that's why it's for hobby use, but we could probably get Bob to
> add a few lines to the makefile (and the zip archive).  When I first saw
> this problem, I just looked into the makefile and noticed that the build
> information was only checking for Apples, PizzaBoxes and Winderz.

And apparently it only works accidentally on OS X.  I know for sure that
it only works by accident on cygwin (and you actually have to either
disable one of the simulators or patch it to make it build).

>   I was
> running Slack, so I just changed the OSTYPE conditional from "macos" to
> "linux".  If you wanted to add a few lines to the makefile for different
> platforms, you could just add a conditional statement such as this:
> 
> ifeq ($(OSTYPE),linux)

That would have to be 'ifeq ($(shell echo $$OSTYPE),linux)' to have a
better (but not perfect) chance of success.

Not everything that looks like an environment variable actually is.
Some of them are actually shell variables.  Sure, you can refer to them
in shell scripts and print them out with 'echo' but child programs can't
see them.  You would have to explicitly export them first.

GNU make automatically imports environment variables but not shell
variables.

The shell I use here (bash on Ubuntu Feisty Fawn) has OSTYPE as an
unexported shell variable so it isn't visible from within GNU make.

Furthermore, the default POSIX shell (the one you get when you
run /bin/sh) is dash, not bash.  Dash is also the default shell for
users.  Dash is both very minimal and very POSIX compliant.  It does not
have the OSSHELL variable at all.

There are other POSIX compatible shells (ksh/pdksh, for example).

A better way is to use uname and grep -i for linux in the output.
That actually works on more platforms.

A few people ran the platform test makefile I posted a week ago (I'm
sorry that I still haven't followed properly up on that).  One of them
even ran the test on some really oddball platforms.

The only that uname/grep didn't work on was one that as far as I could
tell didn't use GNU make.

The current test method failed almost everywhere -- and the strings
tested in the current makefile are mostly wrong or missing.  Asking the
shell for OSTYPE works much better.  uname/grep almost universally
works.

> CC = gcc -std=c99 -O2 -U__STRICT_ANSI__ -g -lm -lrt $(OS_CCDEFS) -I .
> endif
> 
> I put this 18 lines down in the makefile.  This should be accurate for
> "most" of the linux distributions, PROVIDED that you MAKE SURE you build
> from csh.  Don't use the default BASH (and many linux sh are BASH) as
> the environment variables are different.

Precisely.  [And who on Earth uses csh these days? ;)]

My 'build' branch at http://vax64.dyndns.org/repo/hg has these tests.

There are many other problems with the current makefile.  The 'build'
branch is an attempt to fix them.  It is a little bit out of date as it
doesn't build all the simulators but the code in my local directory
does.

> It would also be nice if Bob would create an empty BIN folder in the zip
> archive (since the build stops when it's not there the first time).

Yes!

An other improvement would be to include the directory in the zipfile,
preferably with the version number encoded in it:

simh-3.7-3/scp.c
simh-3.7-3/scp.h
simh-3.7-3/Interdata
 ...

(simh-3.7.3/ with a correspondingly named simh-3.7.3.zip would of course
be better.)

Just a bit of poka-yoke.

>   The
> missing BIN folder is just a trivial point, but catches me every time I
> open up an updated release (make...wait, BIN error, mkdir BIN, make).

Actually, it can be fixed in the makefile, too, which is what I've done
in the 'build' branch.  Since I build each simulator in its own
directory, I needed to create directories on the fly anyway.

-Peter




More information about the Simh mailing list