Merge pull request #16 from cryptorick/freebsd-first-class

Make FreeBSD a "first class citizen" among femtolisp's build OSes.
This commit is contained in:
Jeff Bezanson 2015-04-19 19:04:32 -04:00
commit 2923137ef0
7 changed files with 16 additions and 9 deletions

View File

@ -1,4 +1,5 @@
CC = gcc FREEBSD-GE-10 = $(shell test `uname` = FreeBSD -a `uname -r | cut -d. -f1` -ge 10 && echo YES)
CC = $(if $(FREEBSD-GE-10),clang,gcc)
NAME = flisp NAME = flisp
SRCS = $(NAME).c builtins.c string.c equalhash.c table.c iostream.c SRCS = $(NAME).c builtins.c string.c equalhash.c table.c iostream.c
@ -32,7 +33,7 @@ flmain.o: flmain.c flisp.h
flmain.do: flmain.c flisp.h flmain.do: flmain.c flisp.h
$(LLT): $(LLT):
cd $(LLTDIR) && make cd $(LLTDIR) && $(MAKE)
$(LIBTARGET).da: $(DOBJS) $(LIBTARGET).da: $(DOBJS)
rm -rf $@ rm -rf $@
@ -44,7 +45,7 @@ $(LIBTARGET).a: $(OBJS)
debug: $(DOBJS) $(LIBFILES) $(LIBTARGET).da flmain.do debug: $(DOBJS) $(LIBFILES) $(LIBTARGET).da flmain.do
$(CC) $(DEBUGFLAGS) $(DOBJS) flmain.do -o $(EXENAME) $(LIBS) $(LIBTARGET).da $(CC) $(DEBUGFLAGS) $(DOBJS) flmain.do -o $(EXENAME) $(LIBS) $(LIBTARGET).da
make test $(MAKE) test
release: $(OBJS) $(LIBFILES) $(LIBTARGET).a flmain.o release: $(OBJS) $(LIBFILES) $(LIBTARGET).a flmain.o
$(CC) $(SHIPFLAGS) $(OBJS) flmain.o -o $(EXENAME) $(LIBS) $(LIBTARGET).a $(CC) $(SHIPFLAGS) $(OBJS) flmain.o -o $(EXENAME) $(LIBS) $(LIBTARGET).a

View File

@ -2307,6 +2307,8 @@ static void lisp_init(size_t initial_heapsize)
set(symbol("*os-name*"), symbol("macos")); set(symbol("*os-name*"), symbol("macos"));
#elif defined(OPENBSD) #elif defined(OPENBSD)
set(symbol("*os-name*"), symbol("openbsd")); set(symbol("*os-name*"), symbol("openbsd"));
#elif defined(FREEBSD)
set(symbol("*os-name*"), symbol("freebsd"));
#else #else
set(symbol("*os-name*"), symbol("unknown")); set(symbol("*os-name*"), symbol("unknown"));
#endif #endif

View File

@ -1,4 +1,5 @@
CC = gcc FREEBSD-GE-10 = $(shell test `uname` = FreeBSD -a `uname -r | cut -d. -f1` -ge 10 && echo YES)
CC = $(if $(FREEBSD-GE-10),clang,gcc)
SRCS = bitvector.c hashing.c socket.c timefuncs.c ptrhash.c utf8.c ios.c \ SRCS = bitvector.c hashing.c socket.c timefuncs.c ptrhash.c utf8.c ios.c \
dirpath.c htable.c bitvector-ops.c int2str.c dump.c random.c \ dirpath.c htable.c bitvector-ops.c int2str.c dump.c random.c \

View File

@ -95,7 +95,7 @@ char *get_exename(char *buf, size_t size)
/* OpenBSD currently has no way of determining a processes pathname */ /* OpenBSD currently has no way of determining a processes pathname */
return NULL; return NULL;
} }
#elif defined(__FreeBSD__) #elif defined(FREEBSD)
#include <sys/types.h> #include <sys/types.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>

View File

@ -23,13 +23,15 @@
# define MACOSX # define MACOSX
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
# define OPENBSD # define OPENBSD
#elif defined(__FreeBSD__)
# define FREEBSD
#elif defined(_WIN32) #elif defined(_WIN32)
# define WIN32 # define WIN32
#else #else
# error "unknown platform" # error "unknown platform"
#endif #endif
#if defined(OPENBSD) #if defined(OPENBSD) || defined(FREEBSD)
#if defined(__x86_64__) #if defined(__x86_64__)
# define __SIZEOF_POINTER__ 8 # define __SIZEOF_POINTER__ 8
#else #else
@ -70,7 +72,7 @@
# define BIG_ENDIAN __BIG_ENDIAN # define BIG_ENDIAN __BIG_ENDIAN
# define PDP_ENDIAN __PDP_ENDIAN # define PDP_ENDIAN __PDP_ENDIAN
# define BYTE_ORDER __BYTE_ORDER # define BYTE_ORDER __BYTE_ORDER
#elif defined(MACOSX) || defined(OPENBSD) #elif defined(MACOSX) || defined(OPENBSD) || defined(FREEBSD)
# include <machine/endian.h> # include <machine/endian.h>
# define __LITTLE_ENDIAN LITTLE_ENDIAN # define __LITTLE_ENDIAN LITTLE_ENDIAN
# define __BIG_ENDIAN BIG_ENDIAN # define __BIG_ENDIAN BIG_ENDIAN

View File

@ -106,7 +106,7 @@ void timestring(double seconds, char *buffer, size_t len)
#endif #endif
} }
#if defined(LINUX) || defined(MACOSX) || defined(OPENBSD) #if defined(LINUX) || defined(MACOSX) || defined(OPENBSD) || defined(FREEBSD)
extern char *strptime(const char *s, const char *format, struct tm *tm); extern char *strptime(const char *s, const char *format, struct tm *tm);
double parsetime(const char *str) double parsetime(const char *str)
{ {

View File

@ -1,4 +1,5 @@
CC = gcc FREEBSD-GE-10 = $(shell test `uname` = FreeBSD -a `uname -r | cut -d. -f1` -ge 10 && echo YES)
CC = $(if $(FREEBSD-GE-10),clang,gcc)
NAME = lisp NAME = lisp
SRC = $(NAME).c SRC = $(NAME).c