1
0
mirror of https://github.com/livingcomputermuseum/pdp7-unix.git synced 2026-02-24 08:13:05 +00:00

detect OS and chose appropriate c compiler

gcc for linux
clang for OS X and FreeBSD
This commit is contained in:
Tom Everett
2016-03-25 10:52:06 -06:00
parent 81166b31db
commit c791b29a5b

View File

@@ -6,9 +6,41 @@ ASARGS=--format=ptr
MKFS=../tools/mkfs7
A7OUT=../tools/a7out
FSCK=../tools/fsck7
CC=gcc -Wno-multichar
CCARGS=-Wno-multichar
PDP7=pdp7
# detect OS
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
UNAME := LINUX
else
ifeq ($(UNAME), Darwin)
UNAME := DARWIN
else
ifeq ($(UNAME), FreeBSD)
UNAME := FREEBSD
endif
endif
endif
# choose C compiler
ifeq ($(UNAME), LINUX)
# Linux
CC=gcc
else
ifeq ($(UNAME), FREEBSD)
# FreeBSD
CC=cc
else
ifeq ($(UNAME), DARWIN)
# Mac OS X
CC=cc
else
$(error "Unknown OS: " $(UNAME))
endif
endif
endif
# source dirs
SYSSRC=../src/sys
CMDSRC=../src/cmd
@@ -194,7 +226,7 @@ $(BINDIR)/od: $(OTHERSRC)/wktod.s
# B compiler
$(BINDIR)/bc: $(CMDSRC)/bl.s $(CMDSRC)/bi.s ../tools/b.c $(OTHERSRC)/b.b
$(CC) -o b ../tools/b.c
$(CC) $(CCARGS) -o b ../tools/b.c
./b $(OTHERSRC)/b.b b.s
$(AS) $(ASARGS) -o $(BINDIR)/bc $(CMDSRC)/bl.s b.s $(CMDSRC)/bi.s
rm b b.s