
GNOME_FLAGS := $(shell gnome-config --cflags gnome)
IDL_FLAGS := $(shell gnome-config --cflags idl)

BONOBO_LIBS :=  $(shell gnome-config --libs bonobo)
GNOME_LIBS := $(shell gnome-config --libs gnomeui)



SERV_OBJS := main.o  myserver.o iface-skels.o iface-common.o

CLIENT_OBJS :=  myclient.o iface-stubs.o iface-common.o

EXES = myserver myclient myquery

all:	$(EXES)

myserver:	$(SERV_OBJS)
	cc -o myserver $(SERV_OBJS) $(BONOBO_LIBS) $(GNOME_LIBS)

myclient: $(CLIENT_OBJS)
	cc -o myclient $(CLIENT_OBJS)  $(BONOBO_LIBS) $(GNOME_LIBS)

myquery: myquery.o
	cc -o myquery  myquery.o $(BONOBO_LIBS) $(GNOME_LIBS)


iface-common.c iface-skels.c iface-stubs.c iface.h: iface.idl
	orbit-idl $(IDL_FLAGS) iface.idl

main.o: iface.h
myserver.o: myserver.h iface.h


clean:
	rm  -f $(EXES) *.o iface-common.c iface-skels.c iface-stubs.c iface.h

install:
	cp -p iface.oaf  /usr/share/oaf
	cp -p myserver /usr/bin


dist:
	cd .. ; tar -zcvf hello.tar.gz ./hello/Makefile ./hello/README \
          ./hello/iface.idl ./hello/iface.oaf ./hello/main.c \
          ./hello/myclient.c ./hello/myquery.c ./hello/myserver.c \
          ./hello/myserver.h

.c.o:
	cc -g -c $<  $(GNOME_FLAGS)

