51 lines
1.4 KiB
Makefile
51 lines
1.4 KiB
Makefile
CC = 9c
|
|
LD = 9l
|
|
HOSTCC = cc
|
|
CFLAGS = -std=c99 -Wall -Wextra -O2 -g -I.. -I../cutest
|
|
FT_CFLAGS = $(shell pkg-config --cflags freetype2)
|
|
FT_LIBS = $(shell pkg-config --libs freetype2)
|
|
IBUS_CFLAGS = $(shell pkg-config --cflags dbus-1 xkbcommon)
|
|
IBUS_LIBS = $(shell pkg-config --libs dbus-1 xkbcommon)
|
|
LIBS = -lthread -lbio $(FT_LIBS) $(IBUS_LIBS)
|
|
|
|
PROG = unit_test
|
|
LIVE = ibus_live_test
|
|
TESTSRC = unit_test.c test_util.c str_test.c hash_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
|
|
TESTOBJ = $(TESTSRC:.c=.o)
|
|
PARENTSRC = str.c hash.c trie.c dict.c ko.c vi.c ipc.c popup_layout.c \
|
|
font.c
|
|
PARENTOBJ = $(PARENTSRC:%.c=unit_%.o)
|
|
OBJS = $(TESTOBJ) $(PARENTOBJ)
|
|
|
|
all: $(PROG) $(LIVE)
|
|
|
|
check test: $(PROG) $(LIVE)
|
|
./$(PROG) $(TESTARGS)
|
|
./ibus_live_test ../strans ../map
|
|
|
|
$(PROG): $(OBJS)
|
|
$(LD) -o $@ $(OBJS) $(LIBS)
|
|
|
|
ibus_live_test: ibus_live_test.c
|
|
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g $(IBUS_CFLAGS) -o $@ $< $(IBUS_LIBS)
|
|
|
|
$(TESTOBJ): test.h ../dat.h ../fn.h ../ipc.h ../cutest/cutest.h
|
|
engine_test.o: ../strans.c
|
|
ibus_test.o: CFLAGS += $(IBUS_CFLAGS)
|
|
ibus_test.o: ../ibus.c
|
|
server_test.o: ../srv.c
|
|
unit_font.o: CFLAGS += $(FT_CFLAGS)
|
|
|
|
unit_%.o: ../%.c ../dat.h ../fn.h ../ipc.h
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
clean:
|
|
rm -f $(OBJS) $(PROG) $(LIVE)
|
|
|
|
.PHONY: all check test clean
|