changes to support mac compilation better. patches from Stefan.

This commit is contained in:
JeffBezanson 2009-08-24 01:11:36 +00:00
parent be0d4d0d47
commit 12b9013744
6 changed files with 65 additions and 6 deletions

View File

@ -9,7 +9,8 @@ LLTDIR = ../llt
LLT = $(LLTDIR)/libllt.a
FLAGS = -falign-functions -Wall -Wextra -Wno-strict-aliasing -I$(LLTDIR) $(CFLAGS) -DUSE_COMPUTED_GOTO
LIBS = $(LLT) -lm
LIBFILES = $(LLT)
LIBS = $(LIBFILES) -lm
DEBUGFLAGS = -g -DDEBUG $(FLAGS)
SHIPFLAGS = -O2 -DNDEBUG $(FLAGS)
@ -30,11 +31,11 @@ flisp.do: flisp.c cvalues.c types.c flisp.h print.c read.c
$(LLT):
cd $(LLTDIR) && make
debug: $(DOBJS) $(LIBS)
debug: $(DOBJS) $(LIBFILES)
$(CC) $(DEBUGFLAGS) $(DOBJS) -o $(EXENAME) $(LIBS)
make test
release: $(OBJS) $(LIBS)
release: $(OBJS) $(LIBFILES)
$(CC) $(SHIPFLAGS) $(OBJS) -o $(EXENAME) $(LIBS)
clean:

44
femtolisp/Makefile.macosx Normal file
View File

@ -0,0 +1,44 @@
CC = gcc
NAME = flisp
SRCS = $(NAME).c builtins.c string.c equalhash.c table.c iostream.c
OBJS = $(SRCS:%.c=%.o)
DOBJS = $(SRCS:%.c=%.do)
EXENAME = $(NAME)
LLTDIR = ../llt
LLT = $(LLTDIR)/libllt.a
FLAGS = -falign-functions -Wall -Wextra -Wno-strict-aliasing -I$(LLTDIR) $(CFLAGS) -DUSE_COMPUTED_GOTO
LIBFILES = $(LLT)
LIBS = $(LIBFILES) -lm -framework ApplicationServices
DEBUGFLAGS = -g -DDEBUG $(FLAGS)
SHIPFLAGS = -O2 -DNDEBUG $(FLAGS)
default: release test
test:
./flisp unittest.lsp
%.o: %.c
$(CC) $(SHIPFLAGS) -c $< -o $@
%.do: %.c
$(CC) $(DEBUGFLAGS) -c $< -o $@
flisp.o: flisp.c cvalues.c types.c flisp.h print.c read.c
flisp.do: flisp.c cvalues.c types.c flisp.h print.c read.c
$(LLT):
cd $(LLTDIR) && make
debug: $(DOBJS) $(LIBFILES)
$(CC) $(DEBUGFLAGS) $(DOBJS) -o $(EXENAME) $(LIBS)
make test
release: $(OBJS) $(LIBFILES)
$(CC) $(SHIPFLAGS) $(OBJS) -o $(EXENAME) $(LIBS)
clean:
rm -f *.o
rm -f *.do
rm -f $(EXENAME)

View File

@ -2,8 +2,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "ieee754.h"
#include "dtypes.h"
#include "ieee754.h"
int double_exponent(double d)
{

View File

@ -31,6 +31,20 @@
/* OS-level primitive wrappers */
#if defined(MACOSX) || defined(MACINTEL)
void *memrchr(const void *s, int c, size_t n)
{
const unsigned char *src = s + n;
unsigned char uc = c;
while (--src >= (unsigned char *) s)
if (*src == uc)
return (void *) src;
return NULL;
}
#else
extern void *memrchr(const void *s, int c, size_t n);
#endif
static int _fd_available(long fd)
{
#ifndef WIN32

View File

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

View File

@ -1,7 +1,7 @@
#ifndef __UTF8_H_
#define __UTF8_H_
#ifndef MACOSX
#if !defined(MACOSX) && !defined(MACINTEL)
#if !defined(__DTYPES_H_) && !defined(_SYS_TYPES_H)
typedef char int8_t;
typedef short int16_t;