shithub: femtolisp

ref: 465e49a46ffd47fde8b915202773bcc9b34eec57
dir: /Makefile/

View raw version
DESTDIR?=
PREFIX?=/usr/local
BIN=${DESTDIR}${PREFIX}/bin

TARG=flisp
LLT=llt/libllt.a
CFLAGS?=-O2 -g
CFLAGS+=-Wall -Wextra -Wno-parentheses -std=c99 -D_DEFAULT_SOURCE
LDFLAGS?=

OBJS=\
	flmain.o\
	flisp.o\
	builtins.o\
	string.o\
	equalhash.o\
	table.o\
	iostream.o\

.PHONY: all default test clean

all: default

default: ${TARG}

test: ${TARG}
	cd test && ../$(TARG) unittest.lsp

${TARG}: ${OBJS} ${LLT}
	${CC} -o $@ ${OBJS} ${LDFLAGS} ${LLT} -lm

.SUFFIXES: .c .o
.c.o:
	${CC} -o $@ -c $< ${CFLAGS} -Iposix -Illt

flisp.o: flisp.c cvalues.c operators.c types.c flisp.h print.c read.c equal.c maxstack.inc opcodes.h builtin_fns.h
flmain.o: flmain.c boot.h flisp.h

boot.h: flisp.boot
	sed 's,\\,\\\\,g;s,",\\",g;s,^,",g;s,$$,\\n",g' flisp.boot >$@

builtin_fns.h:
	sed -nE 's/^BUILTIN[_]?(\(".*)/BUILTIN_FN\1/gp' *.c >$@

${LLT}:
	${MAKE} -C llt CFLAGS="${CFLAGS} -I../posix" CC="${CC}"

clean:
	rm -f *.o ${TARG}
	${MAKE} -C llt clean