xim/keymap.c held one 37-line function apart from xim.c, with its own prototype typed by hand in xim.c and nelem spelt out because it avoided dat.h — all so that a test could link it without imdkit, though the XIM adapter test #includes xim.c whole anyway. It lives in xim.c now, and xim.c, the last file of its directory, sits beside ibus.c.
139 lines
5.0 KiB
Makefile
139 lines
5.0 KiB
Makefile
CC = 9c
|
|
LD = 9l
|
|
HOSTCC = cc
|
|
PKG_CONFIG ?= pkg-config
|
|
CFLAGS ?= -O2 -g
|
|
UNIT_CPPFLAGS = -I.. -I../cutest
|
|
UNIT_CFLAGS = -std=c99 -Wall -Wextra
|
|
HOST_CFLAGS = -std=c99 -Wall -Wextra
|
|
TEXT_CFLAGS = $(shell $(PKG_CONFIG) --cflags pangocairo cairo fontconfig)
|
|
TEXT_LIBS = $(shell $(PKG_CONFIG) --libs pangocairo cairo fontconfig)
|
|
DBUS_CFLAGS = $(shell $(PKG_CONFIG) --cflags dbus-1)
|
|
DBUS_LIBS = $(shell $(PKG_CONFIG) --libs dbus-1)
|
|
GTK_CFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
|
|
GTK_LIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0)
|
|
IBUS_CFLAGS = $(shell $(PKG_CONFIG) --cflags dbus-1 xkbcommon)
|
|
IBUS_LIBS = $(shell $(PKG_CONFIG) --libs dbus-1 xkbcommon)
|
|
IBUS_CLIENT_CFLAGS = $(shell $(PKG_CONFIG) --cflags ibus-1.0)
|
|
IBUS_CLIENT_LIBS = $(shell $(PKG_CONFIG) --libs ibus-1.0)
|
|
X11_CFLAGS = $(shell $(PKG_CONFIG) --cflags x11)
|
|
X11_LIBS = $(shell $(PKG_CONFIG) --libs x11)
|
|
XIM_CFLAGS = $(shell $(PKG_CONFIG) --cflags xcb-imdkit xcb-xkb xkbcommon-x11)
|
|
XIM_LIBS = $(shell $(PKG_CONFIG) --libs xcb-imdkit xcb-xkb xkbcommon-x11)
|
|
UNIT_LDLIBS = -lthread -lbio $(TEXT_LIBS) $(IBUS_LIBS) $(XIM_LIBS)
|
|
|
|
PROG = unit_test
|
|
STRESS = stress_test
|
|
LIVESRC = live.c live.h
|
|
LIVEBUSSRC = livebus.c livebus.h
|
|
SMOKE = ibus_live_test ibus_client_smoke gtk_live_test xim_live_test \
|
|
ipc_live_test
|
|
FAULT = daemon_collision_test daemon_failure_test daemon_restart_test
|
|
LIVE = $(SMOKE) $(FAULT)
|
|
TESTSRC = test_util.c str_test.c trie_test.c \
|
|
ko_test.c vi_test.c engine_test.c dict_test.c ipc_test.c \
|
|
popup_test.c font_test.c ibus_test.c server_test.c xim_adapter_test.c
|
|
TESTOBJ = $(TESTSRC:.c=.o)
|
|
PARENTSRC = str.c trie.c dict.c ko.c vi.c ipc.c popup_layout.c \
|
|
font.c
|
|
PARENTOBJ = $(PARENTSRC:%.c=unit_%.o)
|
|
COMMONOBJ = $(TESTOBJ) $(PARENTOBJ)
|
|
OBJS = unit_test.o stress_test.o $(COMMONOBJ)
|
|
|
|
all: $(PROG) $(STRESS) $(LIVE)
|
|
|
|
check test: $(PROG)
|
|
./$(PROG) $(UNITARGS)
|
|
|
|
check-live: $(SMOKE) ../strans ../gtk/im-strans.so
|
|
./ibus_live_test ../strans ../map ./ibus_client_smoke
|
|
./gtk_live_test ../gtk/im-strans.so
|
|
./xim_live_test ../strans ../map
|
|
./ipc_live_test ../strans ../map
|
|
|
|
check-stress: $(STRESS) ibus_live_test ipc_live_test $(FAULT) ../strans
|
|
./$(STRESS)
|
|
./ibus_live_test --capacity ../strans ../map
|
|
./ipc_live_test --capacity ../strans ../map
|
|
./daemon_collision_test ../strans ../map
|
|
./daemon_failure_test ../strans
|
|
./daemon_restart_test ../strans ../map
|
|
|
|
$(PROG): unit_test.o $(COMMONOBJ)
|
|
$(LD) $(LDFLAGS) -o $@ unit_test.o $(COMMONOBJ) $(UNIT_LDLIBS) \
|
|
$(LDLIBS)
|
|
|
|
$(STRESS): stress_test.o $(COMMONOBJ)
|
|
$(LD) $(LDFLAGS) -o $@ stress_test.o $(COMMONOBJ) $(UNIT_LDLIBS) \
|
|
$(LDLIBS)
|
|
|
|
stress_test.o: unit_test.c
|
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(UNIT_CFLAGS) $(CFLAGS) -DSTRESS \
|
|
-c -o $@ $<
|
|
|
|
ibus_live_test: ibus_live_test.c $(LIVESRC) $(LIVEBUSSRC) ../ipc.c ../ipc.h
|
|
$(HOSTCC) $(CPPFLAGS) -I.. $(DBUS_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
|
$(LDFLAGS) -o $@ ibus_live_test.c live.c livebus.c ../ipc.c \
|
|
$(DBUS_LIBS) $(LDLIBS)
|
|
|
|
ibus_client_smoke: ibus_client_smoke.c
|
|
$(HOSTCC) $(CPPFLAGS) $(IBUS_CLIENT_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
|
$(LDFLAGS) -o $@ $< $(IBUS_CLIENT_LIBS) $(LDLIBS)
|
|
|
|
gtk_live_test: gtk_live_test.c $(LIVESRC) ../ipc.c ../ipc.h
|
|
$(HOSTCC) $(CPPFLAGS) -I.. $(GTK_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
|
$(LDFLAGS) -o $@ gtk_live_test.c live.c ../ipc.c $(GTK_LIBS) \
|
|
-pthread $(LDLIBS)
|
|
|
|
../gtk/im-strans.so: ../gtk/main.c ../ipc.c ../ipc.h
|
|
$(MAKE) -C ../gtk
|
|
|
|
../strans:
|
|
$(MAKE) -C .. strans
|
|
|
|
xim_live_test: xim_live_test.c $(LIVESRC) ../ipc.c ../ipc.h
|
|
$(HOSTCC) $(CPPFLAGS) -I.. $(X11_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
|
$(LDFLAGS) -o $@ xim_live_test.c live.c ../ipc.c $(X11_LIBS) \
|
|
$(LDLIBS)
|
|
|
|
ipc_live_test: ipc_live_test.c $(LIVESRC) ../ipc.c ../ipc.h
|
|
$(HOSTCC) $(CPPFLAGS) -I.. $(HOST_CFLAGS) $(CFLAGS) $(LDFLAGS) \
|
|
-o $@ ipc_live_test.c live.c ../ipc.c $(LDLIBS)
|
|
|
|
daemon_collision_test: daemon_collision_test.c $(LIVESRC) $(LIVEBUSSRC) \
|
|
../ipc.c ../ipc.h
|
|
$(HOSTCC) $(CPPFLAGS) -I.. $(DBUS_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
|
$(LDFLAGS) -o $@ daemon_collision_test.c live.c livebus.c \
|
|
../ipc.c $(DBUS_LIBS) $(LDLIBS)
|
|
|
|
daemon_failure_test: daemon_failure_test.c $(LIVESRC) ../ipc.c ../ipc.h
|
|
$(HOSTCC) $(CPPFLAGS) -I.. $(HOST_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
|
|
daemon_failure_test.c live.c ../ipc.c $(LDLIBS)
|
|
|
|
daemon_restart_test: daemon_restart_test.c $(LIVESRC) $(LIVEBUSSRC) \
|
|
../ipc.c ../ipc.h
|
|
$(HOSTCC) $(CPPFLAGS) -I.. $(DBUS_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
|
$(LDFLAGS) -o $@ daemon_restart_test.c live.c livebus.c ../ipc.c \
|
|
$(DBUS_LIBS) $(LDLIBS)
|
|
|
|
unit_test.o stress_test.o $(TESTOBJ): test.h ../dat.h ../fn.h ../ipc.h \
|
|
../cutest/cutest.h
|
|
engine_test.o: ../strans.c
|
|
ibus_test.o: UNIT_CPPFLAGS += $(IBUS_CFLAGS)
|
|
ibus_test.o: ../ibus.c
|
|
xim_adapter_test.o: UNIT_CPPFLAGS += $(XIM_CFLAGS)
|
|
xim_adapter_test.o: ../xim.c
|
|
server_test.o: ../srv.c
|
|
unit_font.o: UNIT_CPPFLAGS += $(TEXT_CFLAGS)
|
|
|
|
unit_%.o: ../%.c ../dat.h ../fn.h ../ipc.h
|
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(UNIT_CFLAGS) $(CFLAGS) -c -o $@ $<
|
|
|
|
%.o: %.c
|
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(UNIT_CFLAGS) $(CFLAGS) -c -o $@ $<
|
|
|
|
clean:
|
|
rm -f $(OBJS) $(PROG) $(STRESS) $(LIVE)
|
|
|
|
.PHONY: all check check-live check-stress test clean
|