[Simh] simh make file
Davis Johnson
davis at frizzen.com
Tue Oct 2 21:58:53 EDT 2007
The makefile subject comes up all the time, especially after Bob pushes
out a new version.
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)))
OS_CCDEFS = -lm -lsocket -lnsl -lrt -lpthread -D_GNU_SOURCE
else
ifneq (,$(findstring darwin,$(OSTYPE)))
OS_CCDEFS = -D_GNU_SOURCE
else
OS_CCDEFS = -lrt -lm -D_GNU_SOURCE
endif
endif
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.
2. 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.
3. bash on both my OS/X and Solaris systems include version numbers
in the OSTYPE, thus the findstring in the above conditionals.
4. 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.
5. 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.
6. I don't think I did anything to break the windows build, but I
don't know that for a fact.
7. Note that bash on OS/X sets OSTYPE to darwin, not macos.
8. 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.
9. I don't build with the optional networking support, the emulator I
am most interested in (id32) does not use it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20071002/cc2f857d/attachment-0003.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: makefile
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20071002/cc2f857d/attachment-0003.ksh>
More information about the Simh
mailing list