##################################################################
#   Copyright  2004, Sebastian Heutling. All rights reserved.
#   $Id: Makefile.in,v 1.9 2004/11/05 23:08:57 basti Exp $
#
#   Descr. : Makefile for the kde plugin
#   Authors: Sebastian Heutling, sheutlin@gmx.de
##################################################################
TOP      := ../../../..
include $(TOP)/config/make.tmpl
include ../config/make.cfg
LD       := $(CXX)
FILES    := init GNOMEMessage GNOMEMenu GNOMEOutputPlugin ThreadMessage GNOMEActionPlugin GNOMEAction
LIBNAME  := gnome-gui.so
OBJECTS  := $(foreach f, $(FILES), .$(f).o)
DEPENDS  := $(foreach f, $(FILES), .$(f).d)
cleanobjects=$(OBJECTS) $(LIBNAME) $(DEPENDS)
distcleanobjects= $(cleanobjects)
INCLUDES := -I$(TOP)/server/include -I$(XERCESINCLUDES)
CXXFLAGS += $(INCLUDES) -DDATADIR=\"$(datadir)\" $(shell pkg-config --cflags gtk+-2.0) $(shell pkg-config --cflags libwnck-1.0) $(shell pkg-config --cflags gnome-vfs-2.0)
LDLIBS   := -L$(XERCESLIBS) -lxerces-c -lgthread-2.0
LDFLAGS  := $(LDLIBS) $(shell pkg-config --libs gtk+-2.0) $(shell pkg-config --libs libwnck-1.0) $(shell pkg-config --libs gnome-vfs-2.0) -Wl,--no-undefined
subdirs  := locale

.PHONY: all clean distclean

all: $(LIBNAME)
	@$(call multimake,$(subdirs))

$(eval $(call link_so,$(LIBNAME),$(OBJECTS),$(LDFLAGS)))
$(eval $(call compile_source,cpp,Makefile,$(CXXFLAGS)))
$(eval $(call build_depends,cpp,Makefile $(MOCJECTS),$(CXXFLAGS)))
$(eval $(call clean,$(subdirs),$(cleanobjects)))
$(eval $(call distclean,$(subdirs),$(distcleanobjects)))

install:
	@$(INSTALL) -d $(DESTDIR)$(PLUGINDIR)
	@$(INSTALL) -d $(DESTDIR)/etc/keyman
	@$(INSTALL_DATA) $(LIBNAME) $(DESTDIR)$(PLUGINDIR)
	@$(INSTALL_DATA) .gnome $(DESTDIR)/etc/keyman/gnome
	@$(call multimake,$(subdirs), install)

ifeq (,$(filter clean configure distclean install,$(MAKECMDGOALS)))
-include $(DEPENDS)
endif

