2021-01-02 08:51:01 +03:00
|
|
|
CFLAGS = -g -O3 -fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -DDEBUG
|
2021-01-07 16:52:38 +03:00
|
|
|
LDFLAGS = -L. -Wl,-rpath -Wl,'$$ORIGIN' -Wl,-z,origin
|
2021-01-02 08:51:01 +03:00
|
|
|
LDLIBS = -lkuroko -ldl
|
2021-01-06 04:39:27 +03:00
|
|
|
OBJS = $(patsubst %.c, %.o, $(filter-out rline.c,$(filter-out kuroko.c,$(sort $(wildcard *.c)))))
|
2020-12-26 03:32:21 +03:00
|
|
|
TARGET = kuroko
|
|
|
|
|
2020-12-31 09:48:39 +03:00
|
|
|
MODULES=$(patsubst src/%.c, modules/%.so, $(sort $(wildcard src/*.c)))
|
|
|
|
|
|
|
|
all: ${TARGET} ${MODULES}
|
|
|
|
|
|
|
|
modules/%.so: src/%.c
|
2021-01-07 14:42:25 +03:00
|
|
|
${CC} ${CFLAGS} -shared -o $@ $<
|
2020-12-26 03:32:21 +03:00
|
|
|
|
2021-01-02 08:51:01 +03:00
|
|
|
libkuroko.so: ${OBJS}
|
2021-01-07 14:42:25 +03:00
|
|
|
${CC} ${CLFAGS} -shared -o $@ ${OBJS}
|
2021-01-02 08:51:01 +03:00
|
|
|
|
2020-12-29 12:04:02 +03:00
|
|
|
builtins.c: builtins.krk
|
2021-01-07 02:39:46 +03:00
|
|
|
echo "const char _builtins_src[] = " > builtins.c
|
|
|
|
cat builtins.krk | sed s'/\(.*\)/\"\0\\n\"/' >> builtins.c
|
|
|
|
echo ";" >> builtins.c
|
2020-12-29 12:04:02 +03:00
|
|
|
|
2021-01-06 04:39:27 +03:00
|
|
|
kuroko: libkuroko.so rline.o
|
2020-12-26 03:32:21 +03:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2021-01-07 06:13:47 +03:00
|
|
|
@rm -f ${OBJS} ${TARGET} ${MODULES} libkuroko.so rline.o kuroko.o
|
2020-12-26 03:32:21 +03:00
|
|
|
|
|
|
|
tags: $(wildcard *.c) $(wildcard *.h)
|
|
|
|
@ctags --c-kinds=+lx *.c *.h
|
2021-01-04 15:49:23 +03:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
|
|
|
|
test:
|
|
|
|
@for i in test/*.krk; do echo $$i; ./kuroko $$i > $$i.expect; done
|
|
|
|
@git diff test/*.expect
|