diff --git a/Makefile b/Makefile index 17cb04d9bd..7bf69434a5 100644 --- a/Makefile +++ b/Makefile @@ -36,10 +36,17 @@ BIN=bin LIB=$(shell pwd)/urb RM=rm -f +ifneq ($(UNAME),FreeBSD) CC=gcc CXX=g++ CXXFLAGS=$(CFLAGS) CLD=g++ -O3 -L/usr/local/lib -L/opt/local/lib +else +CC=cc +CXX=c++ +CXXFLAGS=$(CFLAGS) +CLD=c++ -O3 -L/usr/local/lib -L/opt/local/lib +endif ifeq ($(OS),osx) COSFLAGS=-fno-diagnostics-fixit-info diff --git a/README.markdown b/README.markdown index 12694c5456..0799d1a1e1 100644 --- a/README.markdown +++ b/README.markdown @@ -55,6 +55,10 @@ urbit depends on: sudo port install git gmp libsigsegv openssl autoconf automake cmake +#### FreeBSD + + pkg install gmake gmp libsigsegv openssl automake autoconf ragel cmake re2c libtool + Although `automake`/`autoconf`/`libtool` are generally installed by default, some have reported needing to uninstall and reinstall those three packages, at least with Homebrew. Your mileage may vary. @@ -74,6 +78,8 @@ Just run `make`: make +(On FreeBSD, use `gmake` instead.) + Run --- diff --git a/i/c/portable.h b/i/c/portable.h index 4cbf0a3c71..6c2e6cea02 100644 --- a/i/c/portable.h +++ b/i/c/portable.h @@ -146,10 +146,12 @@ /* Sync */ -# if defined(U3_OS_linux) || defined(U3_OS_bsd) +# if defined(U3_OS_linux) # define c3_sync(fd) (fdatasync(fd)) # elif defined(U3_OS_osx) # define c3_sync(fd) (fcntl(fd, F_FULLFSYNC, 0)) +# elif defined(U3_OS_bsd) +# define c3_sync(fd) (fsync(fd)) # else # error "port: sync" # endif diff --git a/outside/anachronism/Makefile b/outside/anachronism/Makefile index 729a33dac5..123576f13c 100644 --- a/outside/anachronism/Makefile +++ b/outside/anachronism/Makefile @@ -1,6 +1,11 @@ SHELL = sh +UNAME = $(shell uname) +ifneq ($(UNAME),FreeBSD) CC = gcc +else +CC = cc +endif FLAGS = -c -fPIC -Iinclude/ CFLAGS = --pedantic -Wall -Wextra -march=native -std=gnu99 INCLUDE = include/anachronism