shithub: femtolisp

ref: 305ad9c2c8c62668bd3df2133494801b99b99a67
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 -I3rd -Illt -Iposix
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\
	3rd/mp/mpadd.o\
	3rd/mp/mpaux.o\
	3rd/mp/mpcmp.o\
	3rd/mp/mpdigdiv.o\
	3rd/mp/mpdiv.o\
	3rd/mp/mpfmt.o\
	3rd/mp/mpleft.o\
	3rd/mp/mplogic.o\
	3rd/mp/mpmul.o\
	3rd/mp/mpright.o\
	3rd/mp/mpsub.o\
	3rd/mp/mptobe.o\
	3rd/mp/mptober.o\
	3rd/mp/mptod.o\
	3rd/mp/mptoi.o\
	3rd/mp/mptoui.o\
	3rd/mp/mptouv.o\
	3rd/mp/mptov.o\
	3rd/mp/mpvecadd.o\
	3rd/mp/mpveccmp.o\
	3rd/mp/mpvecdigmuladd.o\
	3rd/mp/mpvecsub.o\
	3rd/mp/mpvectscmp.o\
	3rd/mp/strtomp.o\
	3rd/mp/u16.o\
	3rd/mp/u32.o\
	3rd/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}

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}