Only ibus.o needs the D-Bus and xkbcommon flags, so give them the same per-object scoping as the popup and XIM objects. The docker targets used -B, which recursive makes inherit: the daemon was linked three times and the live tests built twice per docker-check. gtk/Makefile repeated the module-directory check and cache refresh in install and uninstall.
43 lines
1.5 KiB
Makefile
43 lines
1.5 KiB
Makefile
PROG = im-strans.so
|
|
PKG_CONFIG ?= pkg-config
|
|
CFLAGS ?= -O2
|
|
GTK_CFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
|
|
GTK_LIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0)
|
|
GTK_QUERY_IMMODULES ?= gtk-query-immodules-3.0
|
|
GTK_LIBDIR ?= $(shell $(PKG_CONFIG) --variable=libdir gtk+-3.0 2>/dev/null)
|
|
GTK_BINARY_VERSION ?= $(shell $(PKG_CONFIG) \
|
|
--variable=gtk_binary_version gtk+-3.0 2>/dev/null)
|
|
GTK_RUNTIME_MODULE_DIR = $(shell GTK_PATH= GTK_IM_MODULE_FILE= \
|
|
$(GTK_QUERY_IMMODULES) 2>/dev/null | \
|
|
awk -F '"' '/^"\// { sub("/[^/]*$$", "", $$2); print $$2; exit }')
|
|
GTK_MODULE_DIR ?= $(strip $(if \
|
|
$(and $(strip $(GTK_LIBDIR)),$(strip $(GTK_BINARY_VERSION))),\
|
|
$(GTK_LIBDIR)/gtk-3.0/$(GTK_BINARY_VERSION)/immodules,\
|
|
$(GTK_RUNTIME_MODULE_DIR)))
|
|
|
|
all: $(PROG)
|
|
|
|
$(PROG): main.c ../ipc.c ../ipc.h
|
|
$(CC) $(CPPFLAGS) -I.. $(GTK_CFLAGS) -Wall $(CFLAGS) $(LDFLAGS) \
|
|
-shared -fPIC -o $@ main.c ../ipc.c $(GTK_LIBS) $(LDLIBS)
|
|
|
|
CHECKDIR = test -n "$$module_dir" || { \
|
|
echo "cannot find GTK 3 module directory; set GTK_MODULE_DIR" >&2; \
|
|
exit 1; }
|
|
REFRESH = test -n "$(DESTDIR)" || { \
|
|
unset GTK_PATH GTK_IM_MODULE_FILE; $(GTK_QUERY_IMMODULES) --update-cache; }
|
|
|
|
install: $(PROG)
|
|
module_dir="$(GTK_MODULE_DIR)"; $(CHECKDIR); \
|
|
mkdir -p "$(DESTDIR)$$module_dir" && \
|
|
cp "$(PROG)" "$(DESTDIR)$$module_dir/" && $(REFRESH)
|
|
|
|
uninstall:
|
|
module_dir="$(GTK_MODULE_DIR)"; $(CHECKDIR); \
|
|
rm -f "$(DESTDIR)$$module_dir/$(PROG)" && $(REFRESH)
|
|
|
|
clean:
|
|
rm -f $(PROG)
|
|
|
|
.PHONY: all install uninstall clean
|