[Simh] simh make file
Peter Lund
firefly at vax64.dk
Tue Oct 2 22:46:44 EDT 2007
On Tue, 2007-10-02 at 21:58 -0400, Davis Johnson wrote:
> I've attached the makefile I use to build for Linux (Slackware,
> various ports), Solaris-10 and OS/X.
>
> It is far from ideal, but there are a few points interest. I'll quote
> the relevent snipet for discussion:
> ifeq ($(WIN32),)
> #Unix Environments
> ifneq (,$(findstring solaris,$(OSTYPE)))
Ah, yes, you can also use findstring. I'd forgotten about that
function.
> OS_CCDEFS = -lm -lsocket -lnsl -lrt -lpthread
> -D_GNU_SOURCE
> else
> ifneq (,$(findstring darwin,$(OSTYPE)))
Yep, someone else told me (by private email) about 'darwin' after I
posted the "Platform tests" email.
"macos" is apparently very old, from before OS X.
> OS_CCDEFS = -D_GNU_SOURCE
> else
> OS_CCDEFS = -lrt -lm -D_GNU_SOURCE
> endif
> endif
I see you like indentation, too ;)
One of those new-fangled things that came in fashion in the seventies.
> CC = gcc -std=c99 -U__STRICT_ANSI__ -g $(OS_CCDEFS) -I .
> ifeq ($(USE_NETWORK),)
> else
> NETWORK_OPT = -DUSE_NETWORK
> -isystem /usr/local/include /usr/local/lib/libpcap.a
> endif
> else
> #Win32 Environments
> LDFLAGS = -lm -lwsock32 -lwinmm
> CC = gcc -std=c99 -U__STRICT_ANSI__ -O0 -I.
> EXE = .exe
> ifeq ($(USE_NETWORK),)
> else
> NETWORK_OPT = -DUSE_NETWORK -lwpcap -lpacket
> endif
> endif
>
> 1. OSTYPE isn't universally set, it may be a bash-ism. It doesn't
> get set by the default Bourne shell on Solaris, for example.
> This doesn't bother me much, I always run bash if available
> anyway. There was at least one fellow on the simh-dev list who
> compiles simh for VMS and thinks running bash on VMS is an
> abomination.
Well, it is.
> 1. OSTYPE isn't exported by bash by default. Many people export
> it in their .profile, you can export it manually, or you can
> set it on the make command line.
> 2. bash on both my OS/X and Solaris systems include version
> numbers in the OSTYPE, thus the findstring in the above
> conditionals.
> 3. Solaris 10 ships with no fewer than three versions of make.
> Only gmake (GNU make) works for this makefile. The other two
> spit out cryptic errors I'm insuficiently motivated to decode.
Yep. I figured that since the current makefile requires GNU make (or
something like it) anyway, we might as well rely on it as the primary
build script.
> 1. The above snipit shows my linux bias - the default for other
> os not detected is the linux option. I should detect linux and
> the not found branch should have no libraries specified, like
> the default in the stock makefile.
The current default choice in the stock makefile is used for both Mac OS
X, cygwin, and Linux :(
> 1. I don't think I did anything to break the windows build, but I
> don't know that for a fact.
> 2. Note that bash on OS/X sets OSTYPE to darwin, not macos.
> 3. I really want to build for one of the BSDs. I think I've got
> somthing arround here that should run one of the BSDs. I think
> one of the solaris versions of make that doesn't work (see 4
> above) is a BSD make.
Ah, this brings up the next step in my Cunning Plan.
I can actually make the primary build script generate simpler build
scripts for the dumber platforms.
I have made some proof-of-concept tests and it is actually possible
(it's not even hard).
I intend to generate a BAT file that is just a linear list of
compile/link invocations (with shell variables for the actual programs
to run), a shell script that is similar, a simple makefile that can be
used by any standard make, and possibly a descrip.mss.
The simpler scripts will need a bit of tailoring at the top to make them
invoke the right compiler/linker so they won't work right out of the box
but on the other hand, they should be simple to modify.
The primary build script should be a pleasure to use on the main
platforms (Mac, Cygwin, Linux) and in general Just Work out of the box.
-Peter
More information about the Simh
mailing list