2017-03-28 08:51:24 -04:00
|
|
|
LIBPICRIN_SRCS = \
|
|
|
|
lib/blob.c\
|
|
|
|
lib/bool.c\
|
|
|
|
lib/char.c\
|
|
|
|
lib/cont.c\
|
|
|
|
lib/data.c\
|
|
|
|
lib/debug.c\
|
|
|
|
lib/dict.c\
|
|
|
|
lib/error.c\
|
|
|
|
lib/gc.c\
|
|
|
|
lib/number.c\
|
|
|
|
lib/pair.c\
|
|
|
|
lib/port.c\
|
|
|
|
lib/proc.c\
|
|
|
|
lib/record.c\
|
|
|
|
lib/state.c\
|
|
|
|
lib/string.c\
|
|
|
|
lib/symbol.c\
|
|
|
|
lib/var.c\
|
|
|
|
lib/vector.c\
|
|
|
|
lib/weak.c\
|
2017-03-31 02:59:22 -04:00
|
|
|
lib/ext/boot.c\
|
2017-03-28 10:09:40 -04:00
|
|
|
lib/ext/eval.c\
|
|
|
|
lib/ext/lib.c\
|
|
|
|
lib/ext/load.c\
|
|
|
|
lib/ext/read.c\
|
|
|
|
lib/ext/write.c
|
2017-03-22 10:41:38 -04:00
|
|
|
LIBPICRIN_OBJS = $(LIBPICRIN_SRCS:.c=.o)
|
2015-05-29 07:42:26 -04:00
|
|
|
|
|
|
|
PICRIN_SRCS = \
|
|
|
|
src/main.c\
|
|
|
|
src/load_piclib.c\
|
|
|
|
src/init_contrib.c
|
|
|
|
PICRIN_OBJS = \
|
|
|
|
$(PICRIN_SRCS:.c=.o)
|
|
|
|
|
|
|
|
CONTRIB_SRCS =
|
|
|
|
CONTRIB_OBJS = $(CONTRIB_SRCS:.c=.o)
|
|
|
|
CONTRIB_LIBS =
|
2016-01-08 23:34:51 -05:00
|
|
|
CONTRIB_DEFS =
|
2015-05-29 07:42:26 -04:00
|
|
|
CONTRIB_INITS =
|
|
|
|
CONTRIB_TESTS =
|
|
|
|
CONTRIB_DOCS = $(wildcard contrib/*/docs/*.rst)
|
2015-10-02 01:50:43 -04:00
|
|
|
PICRIN_ISSUE_TESTS = $(wildcard t/issue/*.scm)
|
|
|
|
REPL_ISSUE_TESTS = $(wildcard t/issue/*.sh)
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2017-03-22 10:59:22 -04:00
|
|
|
TEST_RUNNER = picrin
|
2015-07-16 04:44:34 -04:00
|
|
|
|
2017-04-03 00:32:47 -04:00
|
|
|
CFLAGS += -I./lib/include -Wall -Wextra
|
2015-05-30 04:58:25 -04:00
|
|
|
LDFLAGS += -lm
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2015-10-02 07:54:22 -04:00
|
|
|
prefix ?= /usr/local
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2016-03-03 05:59:37 -05:00
|
|
|
all: CFLAGS += -O2 -DNDEBUG=1
|
2017-03-22 10:59:22 -04:00
|
|
|
all: picrin
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2015-07-12 20:54:16 -04:00
|
|
|
debug: CFLAGS += -O0 -g
|
2017-03-22 10:59:22 -04:00
|
|
|
debug: picrin
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2015-07-16 04:45:44 -04:00
|
|
|
include $(sort $(wildcard contrib/*/nitro.mk))
|
|
|
|
|
2017-03-22 10:59:22 -04:00
|
|
|
picrin: CFLAGS += $(CONTRIB_DEFS)
|
|
|
|
picrin: $(PICRIN_OBJS) $(CONTRIB_OBJS) $(LIBPICRIN_OBJS)
|
2017-03-22 10:41:38 -04:00
|
|
|
$(CC) $(CFLAGS) -o $@ $(PICRIN_OBJS) $(CONTRIB_OBJS) $(LIBPICRIN_OBJS) $(LDFLAGS)
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2015-07-08 15:07:12 -04:00
|
|
|
src/load_piclib.c: $(CONTRIB_LIBS)
|
2017-03-23 09:47:55 -04:00
|
|
|
perl tools/mkloader.pl $(CONTRIB_LIBS) > $@
|
2015-05-29 07:42:26 -04:00
|
|
|
|
|
|
|
src/init_contrib.c:
|
2017-03-23 09:47:55 -04:00
|
|
|
perl tools/mkinit.pl $(CONTRIB_INITS) > $@
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2017-03-22 11:40:33 -04:00
|
|
|
# FIXME: Undefined symbols error for _emyg_atod and _emyg_dtoa
|
|
|
|
# libpicrin.so: $(LIBPICRIN_OBJS)
|
|
|
|
# $(CC) -shared $(CFLAGS) -o $@ $(LIBPICRIN_OBJS) $(LDFLAGS)
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2017-04-02 11:37:37 -04:00
|
|
|
lib/ext/boot.c: piclib/boot.scm piclib/library.scm
|
2024-03-01 06:45:05 -05:00
|
|
|
cat piclib/boot.scm piclib/library.scm | perl tools/mkboot.pl > lib/ext/boot.c
|
2015-06-13 00:05:28 -04:00
|
|
|
|
2017-03-28 18:58:08 -04:00
|
|
|
$(LIBPICRIN_OBJS) $(PICRIN_OBJS) $(CONTRIB_OBJS): lib/include/picrin.h lib/include/picrin/*.h lib/khash.h lib/object.h lib/state.h lib/vm.h
|
2015-05-29 07:42:26 -04:00
|
|
|
|
|
|
|
doc: docs/*.rst docs/contrib.rst
|
|
|
|
$(MAKE) -C docs html
|
|
|
|
mkdir -p doc
|
|
|
|
cp -uR docs/_build/* -t doc/
|
|
|
|
|
|
|
|
docs/contrib.rst: $(CONTRIB_DOCS)
|
|
|
|
echo "Contrib Libraries \\\(a.k.a nitros\\\)" > $@
|
|
|
|
echo "================================" >> $@
|
|
|
|
echo "" >> $@
|
|
|
|
cat $(CONTRIB_DOCS) >> $@
|
|
|
|
|
2015-10-02 01:50:43 -04:00
|
|
|
test: test-contribs test-nostdlib test-issue
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2017-03-22 10:59:22 -04:00
|
|
|
test-contribs: picrin $(CONTRIB_TESTS)
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2017-03-31 02:59:22 -04:00
|
|
|
test-nostdlib: lib/ext/boot.c
|
2017-03-28 10:09:40 -04:00
|
|
|
$(CC) -I./lib -I./lib/include -D'PIC_USE_LIBC=0' -D'PIC_USE_STDIO=0' -D'PIC_USE_WRITE=0' -ffreestanding -nostdlib -Os -fPIC -shared -std=c89 -pedantic -Wall -Wextra -Werror -o libpicrin-tiny.so $(LIBPICRIN_SRCS) etc/libc_polyfill.c -fno-stack-protector
|
2017-03-22 11:40:33 -04:00
|
|
|
strip libpicrin-tiny.so
|
|
|
|
ls -lh libpicrin-tiny.so
|
|
|
|
rm -f libpicrin-tiny.so
|
2015-05-30 06:57:12 -04:00
|
|
|
|
2015-10-02 01:50:43 -04:00
|
|
|
test-issue: test-picrin-issue test-repl-issue
|
|
|
|
|
|
|
|
test-picrin-issue: $(TEST_RUNNER) $(PICRIN_ISSUE_TESTS)
|
2015-12-27 23:54:56 -05:00
|
|
|
for test in $(PICRIN_ISSUE_TESTS); do \
|
2017-03-22 10:59:22 -04:00
|
|
|
./$(TEST_RUNNER) "$$test"; \
|
2015-12-27 23:54:56 -05:00
|
|
|
done
|
2015-10-02 01:50:43 -04:00
|
|
|
|
|
|
|
test-repl-issue: $(REPL_ISSUE_TESTS)
|
|
|
|
|
|
|
|
$(REPL_ISSUE_TESTS):
|
2017-03-22 10:59:22 -04:00
|
|
|
PICRIN=./$(TEST_RUNNER) ./$@
|
2015-10-02 01:50:43 -04:00
|
|
|
|
2017-03-22 12:32:07 -04:00
|
|
|
push:
|
|
|
|
git subtree push --prefix=lib git@github.com:picrin-scheme/libpicrin.git master
|
|
|
|
|
2015-05-29 07:42:26 -04:00
|
|
|
install: all
|
2017-03-22 10:59:22 -04:00
|
|
|
install -c picrin $(prefix)/bin/picrin
|
2015-05-29 07:42:26 -04:00
|
|
|
|
|
|
|
clean:
|
2017-03-28 08:51:24 -04:00
|
|
|
$(RM) picrin
|
2017-03-31 02:59:22 -04:00
|
|
|
$(RM) src/load_piclib.c src/init_contrib.c lib/ext/boot.c
|
2017-03-28 08:51:24 -04:00
|
|
|
$(RM) libpicrin.so libpicrin-tiny.so
|
|
|
|
$(RM) $(LIBPICRIN_OBJS)
|
|
|
|
$(RM) $(PICRIN_OBJS)
|
|
|
|
$(RM) $(CONTRIB_OBJS)
|
2015-05-29 07:42:26 -04:00
|
|
|
|
2017-03-23 09:47:55 -04:00
|
|
|
.PHONY: all install clean push test test-r7rs test-contribs test-issue test-picrin-issue test-repl-issue doc $(CONTRIB_TESTS) $(REPL_ISSUE_TESTS)
|