2015-04-11 15:21:02 -04:00
|
|
|
FREEBSD-GE-10 = $(shell test `uname` = FreeBSD -a `uname -r | cut -d. -f1` -ge 10 && echo YES)
|
|
|
|
CC = $(if $(FREEBSD-GE-10),clang,gcc)
|
2008-06-30 21:54:22 -04:00
|
|
|
|
|
|
|
NAME = flisp
|
2009-07-10 00:17:39 -04:00
|
|
|
SRCS = $(NAME).c builtins.c string.c equalhash.c table.c iostream.c
|
2008-06-30 21:54:22 -04:00
|
|
|
OBJS = $(SRCS:%.c=%.o)
|
|
|
|
DOBJS = $(SRCS:%.c=%.do)
|
|
|
|
EXENAME = $(NAME)
|
2010-05-02 14:17:47 -04:00
|
|
|
LIBTARGET = lib$(NAME)
|
2012-02-17 17:58:21 -05:00
|
|
|
LLTDIR = llt
|
2008-06-30 21:58:16 -04:00
|
|
|
LLT = $(LLTDIR)/libllt.a
|
2008-06-30 21:54:22 -04:00
|
|
|
|
2013-03-17 15:02:33 -04:00
|
|
|
FLAGS = -falign-functions -Wall -Wno-strict-aliasing -I$(LLTDIR) $(CFLAGS) -DUSE_COMPUTED_GOTO
|
2009-08-23 21:11:36 -04:00
|
|
|
LIBFILES = $(LLT)
|
|
|
|
LIBS = $(LIBFILES) -lm
|
2008-06-30 21:54:22 -04:00
|
|
|
|
|
|
|
DEBUGFLAGS = -g -DDEBUG $(FLAGS)
|
2009-07-29 00:20:28 -04:00
|
|
|
SHIPFLAGS = -O2 -DNDEBUG $(FLAGS)
|
2008-06-30 21:54:22 -04:00
|
|
|
|
|
|
|
default: release test
|
|
|
|
|
|
|
|
test:
|
2012-02-17 17:38:10 -05:00
|
|
|
cd tests && ../flisp unittest.lsp
|
2008-06-30 21:54:22 -04:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(SHIPFLAGS) -c $< -o $@
|
|
|
|
%.do: %.c
|
|
|
|
$(CC) $(DEBUGFLAGS) -c $< -o $@
|
|
|
|
|
2012-02-26 23:00:47 -05:00
|
|
|
flisp.o: flisp.c cvalues.c operators.c types.c flisp.h print.c read.c equal.c
|
|
|
|
flisp.do: flisp.c cvalues.c operators.c types.c flisp.h print.c read.c equal.c
|
2010-05-02 14:17:47 -04:00
|
|
|
flmain.o: flmain.c flisp.h
|
|
|
|
flmain.do: flmain.c flisp.h
|
2008-06-30 21:54:22 -04:00
|
|
|
|
|
|
|
$(LLT):
|
2015-04-11 15:21:02 -04:00
|
|
|
cd $(LLTDIR) && $(MAKE)
|
2008-06-30 21:54:22 -04:00
|
|
|
|
2010-05-02 14:17:47 -04:00
|
|
|
$(LIBTARGET).da: $(DOBJS)
|
|
|
|
rm -rf $@
|
|
|
|
ar rs $@ $(DOBJS)
|
|
|
|
|
|
|
|
$(LIBTARGET).a: $(OBJS)
|
|
|
|
rm -rf $@
|
|
|
|
ar rs $@ $(OBJS)
|
|
|
|
|
|
|
|
debug: $(DOBJS) $(LIBFILES) $(LIBTARGET).da flmain.do
|
|
|
|
$(CC) $(DEBUGFLAGS) $(DOBJS) flmain.do -o $(EXENAME) $(LIBS) $(LIBTARGET).da
|
2015-04-11 15:21:02 -04:00
|
|
|
$(MAKE) test
|
2008-06-30 21:54:22 -04:00
|
|
|
|
2010-05-02 14:17:47 -04:00
|
|
|
release: $(OBJS) $(LIBFILES) $(LIBTARGET).a flmain.o
|
|
|
|
$(CC) $(SHIPFLAGS) $(OBJS) flmain.o -o $(EXENAME) $(LIBS) $(LIBTARGET).a
|
2008-06-30 21:54:22 -04:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f *.o
|
|
|
|
rm -f *.do
|
|
|
|
rm -f $(EXENAME)
|
2012-02-17 17:53:34 -05:00
|
|
|
rm -f $(LIBTARGET).a
|
|
|
|
rm -f $(LIBTARGET).da
|