Import the XPCOM version
[browser-dbus-bridge.git] / xpcom-dbusservice / build.mk
1 NAME    = dbusservice
2 SOURCES = $(wildcard xpcom-dbusservice/*.cpp)
3
4 PKGS    = dbus-glib-1
5
6 # These are wild guesses, but should be close
7 GECKO_PREFIX = $(shell pkg-config --variable=prefix mozilla-plugin)
8 GECKO_COMPONENT_DIR := $(shell ls -d $(GECKO_PREFIX)/lib/xulrunner-[0-9]* | head -1)/components
9 GECKO_SDK_PATH := $(shell pkg-config --variable=sdkdir mozilla-plugin)
10 XPIDL   = $(GECKO_SDK_PATH)/bin/xpidl
11 PLUGINDIR := $(GECKO_COMPONENT_DIR)
12
13 CFLAGS  += -I$(GECKO_SDK_PATH)/include \
14           -I$(GECKO_SDK_PATH)/include/xpcom \
15           -I$(GECKO_SDK_PATH)/include/nspr \
16           -I$(GECKO_SDK_PATH)/include/string \
17           -I$(GECKO_SDK_PATH)/include/embedstring \
18           -I$(GECKO_SDK_PATH)/include/xpconnect \
19           -I$(GECKO_SDK_PATH)/include/js \
20           -I$(O)/include \
21           -DNO_NSPR_10_SUPPORT
22
23 CFLAGS  += -fno-rtti -fno-exceptions -fshort-wchar
24
25 LDFLAGS += -L$(GECKO_SDK_PATH)/lib
26 LIBS    += -lxpcomglue_s -lnspr4 -lplds4
27
28 include build/plugin.mk
29
30 $(O)/include/IDBusService.h: xpcom-dbusservice/IDBusService.idl
31         $(call echo,Generate,$@)
32         @mkdir -p $(dir $@)
33         @$(XPIDL) -I $(GECKO_SDK_PATH)/idl -m header -e $@ $<
34
35 $(O)/xpt/dbusservice.xpt: xpcom-dbusservice/IDBusService.idl
36         $(call echo,Generate,$@)
37         @mkdir -p $(dir $@)
38         @$(XPIDL) -I $(GECKO_SDK_PATH)/idl -m typelib -e $@ $<
39
40 $(PIC_OBJECTS) $(OBJECTS): $(O)/include/IDBusService.h $(O)/xpt/dbusservice.xpt
41
42 install:: install-xpt
43
44 install-xpt:
45 ifneq ($(wildcard $(O_PLUGIN)),)
46         mkdir -p $(DEST_PLUGINDIR)
47         cp $(O)/xpt/dbusservice.xpt $(DEST_PLUGINDIR)/
48 else
49         @echo XPCOM D-Bus service has not been built, not installing
50 endif
51
52 .PHONY: install-xpt