mirror of
https://github.com/kanaka/mal.git
synced 2024-09-19 09:38:28 +03:00
8a19f60386
- Reorder README to have implementation list after "learning tool" bullet. - This also moves tests/ and libs/ into impls. It would be preferrable to have these directories at the top level. However, this causes difficulties with the wasm implementations which need pre-open directories and have trouble with paths starting with "../../". So in lieu of that, symlink those directories to the top-level. - Move the run_argv_test.sh script into the tests directory for general hygiene.
62 lines
1.4 KiB
Makefile
62 lines
1.4 KiB
Makefile
USE_READLINE ?=
|
|
USE_GC ?= 1
|
|
CFLAGS ?= -g -O2
|
|
LDFLAGS ?= -g
|
|
|
|
#####################
|
|
|
|
SRCS = step0_repl.c step1_read_print.c step2_eval.c step3_env.c \
|
|
step4_if_fn_do.c step5_tco.c step6_file.c step7_quote.c \
|
|
step8_macros.c step9_try.c stepA_mal.c
|
|
OBJS = $(SRCS:%.c=%.o)
|
|
BINS = $(OBJS:%.o=%)
|
|
OTHER_OBJS = types.o readline.o reader.o printer.o env.o core.o interop.o
|
|
OTHER_HDRS = types.h readline.h reader.h printer.h core.h interop.h
|
|
|
|
GLIB_CFLAGS ?= $(shell pkg-config --cflags glib-2.0)
|
|
GLIB_LDFLAGS ?= $(shell pkg-config --libs glib-2.0)
|
|
|
|
FFI_CFLAGS ?= $(shell pkg-config libffi --cflags)
|
|
FFI_LDFLAGS ?= $(shell pkg-config libffi --libs)
|
|
|
|
ifeq ($(shell uname -s),Darwin)
|
|
darwin_CPPFLAGS ?= -DOSX=1
|
|
endif
|
|
|
|
ifeq (,$(USE_READLINE))
|
|
RL_LIBRARY ?= edit
|
|
else
|
|
RL_LIBRARY ?= readline
|
|
rl_CFLAGS ?= -DUSE_READLINE=1
|
|
endif
|
|
|
|
ifneq (,$(USE_GC))
|
|
gc_CFLAGS ?= -DUSE_GC=1
|
|
gc_LIBS ?= -lgc
|
|
endif
|
|
|
|
# Rewrite CPPFLAGS for the Make recipes, but let existing user options
|
|
# take precedence.
|
|
override CPPFLAGS := \
|
|
${darwin_CPPFLAGS} ${rl_CFLAGS} ${gc_CFLAGS} ${GLIB_CFLAGS} ${FFI_CFLAGS} \
|
|
${CPPFLAGS}
|
|
override LDLIBS += \
|
|
${gc_LIBS} -l${RL_LIBRARY} ${GLIB_LDFLAGS} ${FFI_LDFLAGS} -ldl
|
|
|
|
#####################
|
|
|
|
all: $(BINS)
|
|
|
|
dist: mal
|
|
|
|
mal: $(word $(words $(BINS)),$(BINS))
|
|
cp $< $@
|
|
|
|
$(OBJS) $(OTHER_OBJS): %.o: %.c $(OTHER_HDRS)
|
|
|
|
$(patsubst %.o,%,$(filter step%,$(OBJS))): $(OTHER_OBJS)
|
|
$(BINS): %: %.o
|
|
|
|
clean:
|
|
rm -f $(OBJS) $(BINS) $(OTHER_OBJS) mal
|