77 lines
2.7 KiB
Makefile
77 lines
2.7 KiB
Makefile
LIBKKC_VERSION = 0.3.5
|
|
TOP_LIBKKC_BUILD_DIR = .
|
|
TOP_LIBKKC_SRC_DIR = .
|
|
#DEBUG_LIBS = -L$(TOP_LIBKKC_BUILD_DIR)/libkkc-$(LIBKKC_VERSION)/libkkc/.libs
|
|
|
|
COMMON_CFLAGS = \
|
|
-DHAVE_CONFIG_H -I. -pipe -Wall -Werror=format-security \
|
|
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong \
|
|
-grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables \
|
|
-fstack-clash-protection -fcf-protection -fPIC \
|
|
-g -O2 \
|
|
$(NULL)
|
|
PKG_CONFIG_CFLAGS = \
|
|
$(shell pkg-config --cflags marisa gee-0.8 json-glib-1.0 glib-2.0) \
|
|
-I$(TOP_LIBKKC_SRC_DIR)/libkkc-$(LIBKKC_VERSION) \
|
|
$(NULL)
|
|
CFLAGS = $(COMMON_CFLAGS) $(PKG_CONFIG_CFLAGS)
|
|
|
|
COMMON_LIBS = \
|
|
-pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 \
|
|
-Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong \
|
|
-grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables \
|
|
-fstack-clash-protection -fcf-protection -g -O0 \
|
|
-Wl,-z -Wl,relro -Wl,-z -Wl,now \
|
|
$(NULL)
|
|
PKG_CONFIG_LIBS = \
|
|
$(shell pkg-config --libs marisa gee-0.8 json-glib-1.0 glib-2.0) \
|
|
$(DEBUG_LIBS) -lkkc
|
|
$(NULL)
|
|
LDFLAGS = $(COMMON_LIBS) $(PKG_CONFIG_LIBS)
|
|
|
|
|
|
all: context
|
|
|
|
context.c: context.vala
|
|
valac --disable-warnings --vapidir=. \
|
|
--vapidir=$(TOP_LIBKKC_SRC_DIR)/libkkc-$(LIBKKC_VERSION)/libkkc \
|
|
--pkg gobject-2.0 --pkg gio-2.0 --pkg gee-0.8 --pkg json-glib-1.0 \
|
|
--pkg kkc-internals-1.0 -g --target-glib=2.24 \
|
|
-C context.vala test-case.vala \
|
|
$(NULL)
|
|
|
|
context.o: context.c
|
|
gcc $(COMMON_CFLAGS) $(CFLAGS) -g -O0 -c -o context.o context.c
|
|
gcc $(COMMON_CFLAGS) $(CFLAGS) -g -O0 -c -o test-case.o test-case.c
|
|
|
|
context: context.o
|
|
gcc $(LDFLAGS) -o context context.o test-case.o
|
|
|
|
clean:
|
|
rm *.o *.c context
|
|
|
|
run-debug:
|
|
env LD_LIBRARY_PATH=$(TOP_LIBKKC_BUILD_DIR)/libkkc-$(LIBKKC_VERSION)/libkkc/.libs gdb ./context
|
|
|
|
run:
|
|
./context
|
|
|
|
data/models/sorted3/data.3gram.filter:
|
|
mkdir -p data/models/sorted3
|
|
cp $(TOP_LIBKKC_SRC_DIR)/libkkc-$(LIBKKC_VERSION)/data/templates/libkkc-data/data/models/sorted3/metadata.json \
|
|
data/models/sorted3/.
|
|
cp $(TOP_LIBKKC_SRC_DIR)/libkkc-$(LIBKKC_VERSION)/tests/data/models/text3/data.arpa \
|
|
data/models/sorted3/.
|
|
python3 $(TOP_LIBKKC_SRC_DIR)/libkkc-$(LIBKKC_VERSION)/data/templates/libkkc-data/tools/sortlm.py \
|
|
data/models/sorted3/data.arpa \
|
|
data/models/sorted3/data
|
|
python3 $(TOP_LIBKKC_SRC_DIR)/libkkc-$(LIBKKC_VERSION)/data/templates/libkkc-data/tools/genfilter.py \
|
|
data/models/sorted3/data.2gram \
|
|
data/models/sorted3/data.2gram.filter \
|
|
12
|
|
python3 $(TOP_LIBKKC_SRC_DIR)/libkkc-$(LIBKKC_VERSION)/data/templates/libkkc-data/tools/genfilter.py \
|
|
data/models/sorted3/data.3gram \
|
|
data/models/sorted3/data.3gram.filter \
|
|
10
|
|
|