kuroko/Makefile

36 lines
948 B
Makefile
Raw Normal View History

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
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)))))
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 $@ $<
libkuroko.so: ${OBJS}
2021-01-07 14:42:25 +03:00
${CC} ${CLFAGS} -shared -o $@ ${OBJS}
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
.PHONY: clean
clean:
2021-01-07 06:13:47 +03:00
@rm -f ${OBJS} ${TARGET} ${MODULES} libkuroko.so rline.o kuroko.o
tags: $(wildcard *.c) $(wildcard *.h)
@ctags --c-kinds=+lx *.c *.h
.PHONY: test
test:
@for i in test/*.krk; do echo $$i; ./kuroko $$i > $$i.expect; done
@git diff test/*.expect