changes to support mac compilation better. patches from Stefan.
This commit is contained in:
		
							parent
							
								
									be0d4d0d47
								
							
						
					
					
						commit
						12b9013744
					
				| 
						 | 
					@ -9,7 +9,8 @@ LLTDIR = ../llt
 | 
				
			||||||
LLT = $(LLTDIR)/libllt.a
 | 
					LLT = $(LLTDIR)/libllt.a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FLAGS = -falign-functions -Wall -Wextra -Wno-strict-aliasing -I$(LLTDIR) $(CFLAGS) -DUSE_COMPUTED_GOTO
 | 
					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)
 | 
					DEBUGFLAGS = -g -DDEBUG $(FLAGS)
 | 
				
			||||||
SHIPFLAGS = -O2 -DNDEBUG $(FLAGS)
 | 
					SHIPFLAGS = -O2 -DNDEBUG $(FLAGS)
 | 
				
			||||||
| 
						 | 
					@ -30,11 +31,11 @@ flisp.do: flisp.c cvalues.c types.c flisp.h print.c read.c
 | 
				
			||||||
$(LLT):
 | 
					$(LLT):
 | 
				
			||||||
	cd $(LLTDIR) && make
 | 
						cd $(LLTDIR) && make
 | 
				
			||||||
 | 
					
 | 
				
			||||||
debug: $(DOBJS) $(LIBS)
 | 
					debug: $(DOBJS) $(LIBFILES)
 | 
				
			||||||
	$(CC) $(DEBUGFLAGS) $(DOBJS) -o $(EXENAME) $(LIBS)
 | 
						$(CC) $(DEBUGFLAGS) $(DOBJS) -o $(EXENAME) $(LIBS)
 | 
				
			||||||
	make test
 | 
						make test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
release: $(OBJS) $(LIBS)
 | 
					release: $(OBJS) $(LIBFILES)
 | 
				
			||||||
	$(CC) $(SHIPFLAGS) $(OBJS) -o $(EXENAME) $(LIBS)
 | 
						$(CC) $(SHIPFLAGS) $(OBJS) -o $(EXENAME) $(LIBS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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)
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,8 @@
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include "ieee754.h"
 | 
					 | 
				
			||||||
#include "dtypes.h"
 | 
					#include "dtypes.h"
 | 
				
			||||||
 | 
					#include "ieee754.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int double_exponent(double d)
 | 
					int double_exponent(double d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								llt/ios.c
								
								
								
								
							
							
						
						
									
										14
									
								
								llt/ios.c
								
								
								
								
							| 
						 | 
					@ -31,6 +31,20 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* OS-level primitive wrappers */
 | 
					/* 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)
 | 
					static int _fd_available(long fd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifndef WIN32
 | 
					#ifndef WIN32
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,7 +105,7 @@ void timestring(double seconds, char *buffer, size_t len)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef LINUX
 | 
					#if defined(LINUX) || defined(MACOSX) || defined(MACINTEL)
 | 
				
			||||||
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(char *str)
 | 
					double parsetime(char *str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
#ifndef __UTF8_H_
 | 
					#ifndef __UTF8_H_
 | 
				
			||||||
#define __UTF8_H_
 | 
					#define __UTF8_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef MACOSX
 | 
					#if !defined(MACOSX) && !defined(MACINTEL)
 | 
				
			||||||
#if !defined(__DTYPES_H_) && !defined(_SYS_TYPES_H)
 | 
					#if !defined(__DTYPES_H_) && !defined(_SYS_TYPES_H)
 | 
				
			||||||
typedef char int8_t;
 | 
					typedef char int8_t;
 | 
				
			||||||
typedef short int16_t;
 | 
					typedef short int16_t;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue