PACKAGE = lxp-icewm
VERSION = 1.2.30
HOSTOS  = Linux 2.6.15-27-386
HOSTCPU = i686

LIBDIR = /usr/share/lxp-icewm
CFGDIR = /etc/lxp-icewm
LOCDIR = /usr/share/locale
DOCDIR = /usr/share/doc

################################################################################

CXX =           g++
LD =            g++
EXEEXT =        

DEBUG =         
GCCDEP =        
DEFS =          -DHAVE_CONFIG_H \
                -DLIBDIR='"$(LIBDIR)"' \
                -DCFGDIR='"$(CFGDIR)"' \
                -DLOCDIR='"$(LOCDIR)"' \
                -DKDEDIR='"$(KDEDIR)"' \
                -DPACKAGE='"lxp-icewm"' \
                -DVERSION='"$(VERSION)"' \
                -DHOSTOS='"$(HOSTOS)"' \
                -DHOSTCPU='"$(HOSTCPU)"' \
                -DEXEEXT='"$(EXEEXT)"' \
                -DICEWMEXE='"lxp-icewm$(EXEEXT)"' \
                -DICEWMTRAYEXE='"lxp-icewmtray$(EXEEXT)"' \
                -DICEWMBGEXE='"lxp-icewmbg$(EXEEXT)"' \
                -DICESMEXE='"lxp-icewm-session$(EXEEXT)"' \
                -DICEHELPEXE='"lxp-icehelp$(EXEEXT)"' \
                -DICEHELPIDX='"$(DOCDIR)/lxp-icewm-$(VERSION)/icewm.html"'

CXXFLAGS =      -fpermissive -Wall -Wpointer-arith -Wconversion -Wwrite-strings -Winline -Woverloaded-virtual -W -fno-exceptions -fno-rtti -g -O2 $(DEBUG) $(DEFS) \
	         -I/usr/include -I/usr/include/freetype2 -I/usr/include  # `fc-config --cflags`
LFLAGS =	
LIBS =          

CORE_LIBS =     -lXinerama  -lSM -lICE  -lX11  -L/usr/X11R6/lib  -lXrandr -lXrender -lXext -lXft -lX11 -lfreetype -lz -lfontconfig -lXrender -lX11 # `fc-config --libs`
IMAGE_LIBS =    -L/usr/lib -lImlib -ljpeg -ltiff -lungif -lpng -lz -lm -lXext -L/usr/lib -lSM -lICE -lXext -lX11
AUDIO_LIBS =    
GNOME1_LIBS =    
GNOME2_LIBS =    -pthread -lgnome-desktop-2 -lgnomeui-2 -lSM -lICE -lstartup-notification-1 -lbonoboui-2 -lgnome-keyring -lxml2 -lz -lgnomecanvas-2 -lgnome-2 -lpopt -lart_lgpl_2 -lpangoft2-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lfontconfig -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0 -lcairo -lX11 -lgnomevfs-2 -lbonobo-2 -lgconf-2 -lgobject-2.0 -lbonobo-activation -lORBit-2 -lm -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0  

################################################################################

libice_OBJS = ref.o \
        yapp.o yxapp.o ytimer.o ywindow.o ypaint.o ypopup.o \
        misc.o ycursor.o ysocket.o \
        ypaths.o ypixbuf.o ylocale.o yarray.o ypipereader.o \
        yxembed.o yconfig.o yprefs.o \
        yfont.o yfontcore.o yfontxft.o \
	yimage.o \
        ytooltip.o  # FIXME
        
libitk_OBJS = \
	ymenu.o ylabel.o yscrollview.o \
        ymenuitem.o yscrollbar.o ybutton.o ylistbox.o yinput.o \
        wmconfig.o yicon.o # FIXME

genpref_OBJS = \
	genpref.o

lxp-icewm_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icewm_OBJS = \
        ymsgbox.o ydialog.o yurl.o \
        wmsession.o wmwinlist.o wmtaskbar.o wmwinmenu.o \
        wmdialog.o wmabout.o wmswitch.o wmstatus.o \
        wmoption.o wmaction.o \
        wmcontainer.o wmclient.o \
        wmmgr.o wmapp.o \
        wmframe.o wmbutton.o wmminiicon.o wmtitle.o movesize.o \
        themes.o decorate.o browse.o \
        wmprog.o \
        atasks.o aworkspaces.o amailbox.o aclock.o acpustatus.o \
	apppstatus.o aaddressbar.o objbar.o aapm.o amixer.o atray.o ysmapp.o \
        yxtray.o \
        $(libitk_OBJS) $(libice_OBJS)

lxp-icesh_LIBS = \
	$(CORE_LIBS)
lxp-icesh_OBJS = \
	icesh.o misc.o

lxp-icewm-session_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icewm-session_OBJS = \
	icesm.o $(libice_OBJS)

lxp-icewmhint_LIBS = \
	$(CORE_LIBS)
lxp-icewmhint_OBJS = \
	icewmhint.o

lxp-icewmbg_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icewmbg_OBJS = \
	icewmbg.o $(libice_OBJS)

lxp-icesound_LIBS = \
	$(CORE_LIBS) $(AUDIO_LIBS)
lxp-icesound_OBJS = \
	icesound.o misc.o ycmdline.o

lxp-icewm-menu-gnome1_LIBS = \
	$(CORE_LIBS) $(GNOME1_LIBS)
lxp-icewm-menu-gnome1_OBJS = \
	gnome.o misc.o ycmdline.o yarray.o

lxp-icewm-menu-gnome2_LIBS = \
	$(CORE_LIBS) $(GNOME2_LIBS)
lxp-icewm-menu-gnome2_OBJS = \
	gnome2.o misc.o ycmdline.o yarray.o

lxp-icehelp_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icehelp_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) icehelp.o

lxp-iceclock_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) iceclock.o aclock.o
lxp-iceclock_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icebar_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) \
        wmtaskbar.o \
        wmprog.o browse.o themes.o wmaction.o \
	amailbox.o aclock.o acpustatus.o apppstatus.o aaddressbar.o objbar.o
lxp-icewmtray_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) yxtray.o icetray.o
lxp-icewmtray_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icesame_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) icesame.o
lxp-icesame_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icelist_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) icelist.o
lxp-icelist_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-iceview_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) iceview.o
lxp-iceview_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-iceicon_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) iceicon.o
lxp-iceicon_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-icerun_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) icerun.o
lxp-icerun_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
lxp-iceskt_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) iceskt.o
testmenus_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS) 
testmenus_OBJS = \
	$(libitk_OBJS) $(libice_OBJS) testmenus.o wmprog.o wmaction.o themes.o browse.o
testwinhints_OBJS= \
        testwinhints.o
testwinhints_LIBS = \
        $(CORE_LIBS) $(IMAGE_LIBS)

testnetwmhints_OBJS= \
        testnetwmhints.o
testnetwmhints_LIBS = \
        $(CORE_LIBS) $(IMAGE_LIBS)

testmap_OBJS = \
        testmap.o
testmap_LIBS = \
        $(CORE_LIBS) $(IMAGE_LIBS)

testlocale_OBJS = \
	testlocale.o ylocale.o misc.o
testdesktop_OBJS = \
	testdesktop.o ydesktop.o yparser.o ylocale.o misc.o
testdesktop_LIBS = \
	$(CORE_LIBS) $(IMAGE_LIBS)
testarray_OBJS = \
	testarray.o yarray.o misc.o

################################################################################

APPLICATIONS = lxp-icewm lxp-icewm-session lxp-icesh lxp-icewmhint lxp-icewmbg lxp-icewmtray lxp-icehelp lxp-icewm-menu-gnome2
TESTCASES = testarray testdesktop testlocale testmap testmenus testnetwmhints testwinhints iceview icesame iceicon icerun icelist
OBJECTS =  $(lxp-icewm_OBJS) $(lxp-icewm-session_OBJS) $(lxp-icesh_OBJS) $(lxp-icewmhint_OBJS) $(lxp-icewmbg_OBJS) $(lxp-icewmtray_OBJS) $(lxp-icehelp_OBJS) $(lxp-icewm-menu-gnome2_OBJS)  $(testarray_OBJS) $(testdesktop_OBJS) $(testlocale_OBJS) $(testmap_OBJS) $(testmenus_OBJS) $(testnetwmhints_OBJS) $(testwinhints_OBJS) $(iceview_OBJS) $(icesame_OBJS) $(iceicon_OBJS) $(icerun_OBJS) $(icelist_OBJS)
BINARIES =  lxp-icewm lxp-icewm-session lxp-icesh lxp-icewmhint lxp-icewmbg lxp-icewmtray lxp-icehelp lxp-icewm-menu-gnome2  testarray testdesktop testlocale testmap testmenus testnetwmhints testwinhints iceview icesame iceicon icerun icelist

################################################################################

all: base
base:  lxp-icewm lxp-icewm-session lxp-icesh lxp-icewmhint lxp-icewmbg lxp-icewmtray lxp-icehelp lxp-icewm-menu-gnome2 genpref ../lib/preferences
tests:  testarray testdesktop testlocale testmap testmenus testnetwmhints testwinhints iceview icesame iceicon icerun icelist
clean:
	rm -f genpref$(EXEEXT) *.o *.d *~
	for bin in $(BINARIES) ; do rm -f $$bin$(EXEEXT) ; done

.PHONY: all base tests clean

################################################################################

%.o: %.cc
	@echo "  CXX   " $@
	@$(CXX) $(CXXFLAGS) $(GCCDEP) -c $<
	
genpref $(BINARIES):
	@echo "  LD    " $@
	@$(LD) -o $@$(EXEEXT) $($@_OBJS) $(LFLAGS) $($@_LFLAGS) $(LIBS) $($@_LIBS)

################################################################################

gnome.o: gnome.cc
	@echo "  CXX   " $@
	@$(CXX) $(CXXFLAGS)   $(GCCDEP) -c $<

gnome2.o: gnome2.cc
	@echo "  CXX   " $@
	@$(CXX) $(CXXFLAGS)  -DORBIT2=1 -pthread -I/usr/include/gnome-desktop-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libgnomeui-2.0 -I/usr/include/startup-notification-1.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libgnome-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/libbonoboui-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/gnome-keyring-1 -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/freetype2 -I/usr/include/libxml2   $(GCCDEP) -c $<

################################################################################

#libice.so: $(libice_OBJS)
#	-@rm -f $@
#	ld -shared -o $@ $(libice_OBJS)

wmabout.o: ../VERSION

../lib/preferences: genpref
	./genpref$(EXEEXT) >../lib/preferences

genpref: $(genpref_OBJS)

################################################################################

check: 	all tests
	./icewm --help >/dev/null	
	./testarray
	./testlocale

################################################################################
#END

lxp-icewm: $(lxp-icewm_OBJS)
lxp-icewm-session: $(lxp-icewm-session_OBJS)
lxp-icesh: $(lxp-icesh_OBJS)
lxp-icewmhint: $(lxp-icewmhint_OBJS)
lxp-icewmbg: $(lxp-icewmbg_OBJS)
lxp-icewmtray: $(lxp-icewmtray_OBJS)
lxp-icehelp: $(lxp-icehelp_OBJS)
lxp-icewm-menu-gnome2: $(lxp-icewm-menu-gnome2_OBJS)
testarray: $(testarray_OBJS)
testdesktop: $(testdesktop_OBJS)
testlocale: $(testlocale_OBJS)
testmap: $(testmap_OBJS)
testmenus: $(testmenus_OBJS)
testnetwmhints: $(testnetwmhints_OBJS)
testwinhints: $(testwinhints_OBJS)
iceview: $(iceview_OBJS)
icesame: $(icesame_OBJS)
iceicon: $(iceicon_OBJS)
icerun: $(icerun_OBJS)
icelist: $(icelist_OBJS)
