shithub: femtolisp

ref: e9039ef075ee2d96fbd8dd6eae191448acf43751
dir: /Makefile/

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

TARG=flisp
CFLAGS?=-O2 -g
CFLAGS+=-Wall -Wextra -Wno-parentheses -std=c99
LDFLAGS?=

OBJS=\
	flmain.o\
	flisp.o\
	builtins.o\
	string.o\
	equalhash.o\
	table.o\
	iostream.o\
	llt/bitvector-ops.o\
	llt/bitvector.o\
	llt/dump.o\
	llt/hashing.o\
	llt/htable.o\
	llt/int2str.o\
	llt/ios.o\
	llt/lltinit.o\
	llt/ptrhash.o\
	llt/random.o\
	llt/timefuncs.o\
	llt/utf8.o\
	mp/mpadd.o\
	mp/mpaux.o\
	mp/mpcmp.o\
	mp/mpdigdiv.o\
	mp/mpdiv.o\
	mp/mpfmt.o\
	mp/mpleft.o\
	mp/mplogic.o\
	mp/mpmul.o\
	mp/mpright.o\
	mp/mpsub.o\
	mp/mptobe.o\
	mp/mptober.o\
	mp/mptod.o\
	mp/mptoi.o\
	mp/mptoui.o\
	mp/mptouv.o\
	mp/mptov.o\
	mp/mpvecadd.o\
	mp/mpveccmp.o\
	mp/mpvecdigmuladd.o\
	mp/mpvecsub.o\
	mp/mpvectscmp.o\
	mp/strtomp.o\
	mp/u16.o\
	mp/u32.o\
	mp/u64.o\

.PHONY: all default test clean

all: default

default: ${TARG}

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

${TARG}: ${OBJS}
	${CC} -o $@ ${OBJS} ${LDFLAGS} -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 >$@

clean:
	rm -f ${OBJS} ${TARG}