VERSION = "0.0.10"

# bonobo is still only remote activation via goad
# uncomment the next line, if you want the bonobo command
# USE_BONOBO := 1

# The idea of GNOCL_USE_GNOME was to make a version of gnocl, 
# which uses only gtk, but no gnome function. But this is
# not implemented. Is there any need for it?
USE_GNOME := 1

TGZDIR=gnocl-$(VERSION)
CVER='$(VERSION)'

# some gnome header files give warning with -pedantic so we use -Wall
CFLAGS = -g -Wall -DVERSION=$(CVER) -Wall 

BONOBO_OBJ = bonobo.o

GNOME_OBJ = \
   about.o \
   app.o \
   appBar.o \
   canvas.o \
   canvasLine.o \
   canvasRE.o \
   canvasText.o \
   canvasWidget.o \
   colorPicker.o \
   dialog.o \
   fontPicker.o \
   pixmap.o 

GTK_OBJ = \
   bind.o \
   box.o \
   button.o \
   checkButton.o \
   clist.o \
   combo.o \
   convert.o \
   dragAndDrop.o \
   entry.o \
   eventBox.o \
   gnocl.o \
   helperFuncs.o \
   label.o \
   menu.o \
   menuItem.o \
   menubar.o \
   notebook.o \
   optionMenu.o \
   paned.o \
   plug.o \
   radioButton.o \
   scale.o \
   scrolledWindow.o \
   socket.o \
   spinButton.o \
   statusbar.o \
   table.o \
   text.o \
   toolbar.o \
   window.o

OBJ = $(GTK_OBJ) 
ifdef USE_GNOME
   OBJ += $(GNOME_OBJ)
   CFLAGS += -DGNOCL_USE_GNOME `gnome-config --cflags gnome glib`
   ifdef USE_BONOBO
      OBJ += $(BONOBO_OBJ)
      LIBS := `gnome-config --libs gnomeui bonobox gnorba` 
      CFLAGS += -DGNOCL_USE_BONOBO
   else
      LIBS := `gnome-config --libs gnomeui` 
   endif
else
   LIBS := `gtk-config --libs`
   CFLAGS += `gtk-config --cflags`
endif

gnocl.so: $(OBJ)
	gcc -shared $(CFLAGS) -o gnocl.so $(OBJ) $(LIBS)

clean:
	rm -f $(OBJ) gnocl.so

bz:
	(cd ..; \
	mkdir $(TGZDIR); \
	mkdir $(TGZDIR)/src ; \
	cp -r src/*.c src/*.h src/Makefile $(TGZDIR)/src; \
	cp -r demos doc NEWS README KnownBugs license.terms gpg_key.txt $(TGZDIR); \
	tar -cjf gnocl-$(VERSION).tar.bz2 $(TGZDIR);  \
	rm -rf $(TGZDIR) )

test-bz:
	tar -xvjf gnocl-$(VERSION).tar.bz2
	cd $(TGZDIR) && make && .demos/test.tcl
	rm -rf $(TGZDIR)

