#
# Makefile for gaim
#
# Uncomment USE_XMHTML to use the gtk-xmhtml widget for better rendering
# USE_XMHTML=1
#
# Uncomment USE_THEMES for gtk-themes _OR_ USE_APPLET to build as a gnome-applet
# USE_THEMES=1
# USE_APPLET=1
#
# Uncomment USE_GHTTP for GHTTP stuff.  Its not finished yet, but a very, 
#  very preliminary version is there.
# USE_GHTTP=1
#
# If you aren't using a GNU libc, Uncomment the following, eg Solaris
# NO_SNPRINTF=1

ifdef DEBUG
 CFLAGS+=-d -g
endif
CFLAGS+=-Wall -g
ifdef USE_GHTTP
 CFLAGS+=-DUSE_GHTTP
 LIBS+=-lghttp
endif
ifdef USE_APPLET
 CFLAGS+=`gnome-config --cflags gnome gnomeui gtk gnorba` -DUSE_APPLET
 LIBS+=`gnome-config --libs gnome gnomeui gtk gnorba` -lpanel_applet
else
 ifdef USE_THEMES
  CFLAGS+=`gnome-config --cflags gnome gnomeui gtk` -DUSE_THEMES
  LIBS+=`gnome-config --libs gnome gnomeui gtk`
 else
  CFLAGS+=`gtk-config --cflags`
  LIBS+=`gtk-config --libs`
 endif
endif
ifdef USE_XMHTML
 CFLAGS+=-DUSE_XMHTML
 LIBS+=-lgtkxmhtml -ljpeg -lXpm -lpng -lz
endif
CC=gcc
AU2H=./au2h
SOUNDS=BuddyArrive.h BuddyLeave.h Receive.h Send.h
OBJS=aim.o buddy.o toc.o im.o conversation.o buddy_chat.o html.o prefs.o sound.o about.o

aim: $(OBJS)
	$(CC) -o aim $(CFLAGS) $(OBJS) $(LIBS)

BuddyArrive.h: au2h BuddyArrive.au
	$(AU2H) BuddyArrive.au BuddyArrive.h
BuddyLeave.h: au2h BuddyLeave.au
	$(AU2H) BuddyLeave.au BuddyLeave.h
Receive.h: au2h Receive.au
	$(AU2H) Receive.au Receive.h
Send.h: au2h Send.au
	$(AU2H) Send.au Send.h
au2h: au2h.c
	$(CC) -o au2h au2h.c
clean:
	rm -f $(OBJS) $(SOUNDS) au2h core aim
distclean:
	rm -f $(OBJS) $(SOUNDS) au2h core

install: aim
	@./installer $USE_APPLET

sound.o: $(SOUNDS)
