1
0
mirror of https://github.com/prirun/p50em.git synced 2026-03-06 02:38:57 +00:00

Changes to enable building on Solaris, FreeBSD

Solaris (SmartOS) build needs alternative solutions to two termios
things, plus makefile support for additional link libraries.  PNC
support is untested and is likely _very_ slow, since Solaris doesn't
have O_ASYNC.  The usual suggestion is to rewrite such code to use
poll().

Incidental: utilities makefile needed tabs to make `make` happy
on FreeBSD.  Which make?  Don't remember now.
This commit is contained in:
Dennis Boone
2020-05-05 18:37:08 -04:00
parent ebf5511235
commit 8749def64f
4 changed files with 28 additions and 7 deletions

View File

@@ -650,9 +650,22 @@ int devamlc (int class, int func, int device) {
break;
}
memset(&terminfo, 0, sizeof(terminfo));
#ifdef __sun__
terminfo.c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
terminfo.c_oflag &= ~OPOST;
terminfo.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
terminfo.c_cflag &= ~(CSIZE|PARENB);
terminfo.c_cflag |= CS8;
#else
cfmakeraw(&terminfo);
#endif
baud = baudtable[(getcrs16(A) >> 6) & 7];
#ifdef __sun__
if ((cfsetispeed(&terminfo, baud) == -1) ||
(cfsetospeed(&terminfo, baud) == -1))
#else
if (cfsetspeed(&terminfo, baud) == -1)
#endif
perror("em: unable to set AMLC line speed");
else
printf("em: AMLC line %d set to %d bps\n", dx*16 + lx, baud);

View File

@@ -406,7 +406,11 @@ void pncinitfd(int fd) {
perror("unable to get ts flags for PNC");
fatal(NULL);
}
#ifdef __sun__
fdflags |= O_NONBLOCK;
#else
fdflags |= O_NONBLOCK+O_ASYNC;
#endif
if (fcntl(fd, F_SETFL, fdflags) == -1) {
perror("unable to set fdflags for PNC");
fatal(NULL);

View File

@@ -9,23 +9,27 @@ em_deps = \
em.c regs.h emdev.h ea64v.h ea32i.h fp.h dispatch.h geom.h \
devpnc.h devamlc.h swap.h
CFLAGS =
# Uncomment for building on SmartOS/Solaris:
# CFLAGS += -lsocket -lnsl
.PHONY: emwarn debug trace fixed
# normal
em: $(em_deps) $(all_deps)
$(CC) -DREV=\"${REV}\" -DNOTRACE -DFAST -O -Winline -Wno-return-type em.c -o em
$(CC) -DREV=\"${REV}\" ${CFLAGS} -DNOTRACE -DFAST -O -Winline -Wno-return-type em.c -o em
# lots of compiler warnings
emwarn: $(em_deps) $(all_deps)
$(CC) -DREV=\"${REV}\" -DNOTRACE -DFAST -O -Wall -Wextra -pedantic -Wconversion em.c -o em
$(CC) -DREV=\"${REV}\" ${CFLAGS} -DNOTRACE -DFAST -O -Wall -Wextra -pedantic -Wconversion em.c -o em
# gdb
debug: $(em_deps) $(all_deps)
$(CC) -DREV=\"${REV}\" -DNOTRACE -DFAST -g -O0 em.c -o em
$(CC) -DREV=\"${REV}\" ${CFLAGS} -DNOTRACE -DFAST -g -O0 em.c -o em
# tracing
trace: $(em_deps) $(all_deps)
$(CC) -DREV=\"${REV}\" -DFAST -O em.c -o em
$(CC) -DREV=\"${REV}\" ${CFLAGS} -DFAST -O em.c -o em
# the fixed clock rate build is useful for making problems reproduceable.
#
@@ -35,7 +39,7 @@ trace: $(em_deps) $(all_deps)
# fixed clock rate
fixed: $(em_deps) $(all_deps)
$(CC) -DREV=\"${REV}\" -DFIXEDCLOCK -DNOIDLE -DFAST -O em.c -o em
$(CC) -DREV=\"${REV}\" ${CFLAGS} -DFIXEDCLOCK -DNOIDLE -DFAST -O em.c -o em
clean:
rm -f $(em_objs)

View File

@@ -2,7 +2,7 @@ default: emlink intsize magrst magsav mtread mtwrite ptextu strip8 \
untap untap16 untap_vin utextp
# Unix version of Prime's magrst
magrst: magrst.c istext.c
magrst: magrst.c istext.c
# Unix version of Prime's magsav
magsav: magsav.c istext.c
magsav: magsav.c istext.c