#
#               Copyright (c) 1999-2002 Georg Huettenegger
#

CC=gcc
INCLUDES=-Icommon/

# defines to be set for release

DEFINES=-DUSE_GNOME
SCFLAGS=-Wall $(DEFINES) $(INCLUDES)
CFLAGS=`gnome-config --cflags applets` $(SCFLAGS)
LFLAGS=`gnome-config --libs applets`
# the following line worked on RedHat 7.0/1/2
SLFLAGS=-L/usr/lib -L/usr/X11R6/lib -lpanel_applet -lgnorba -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl
# the following line worked on RedHat 6.1
#SLFLAGS=-L/usr/lib -L/usr/X11R6/lib -lpanel_applet -lgnorba -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl

# end of release defines

#SLFLAGS=`gnome-config --libs-only-L applets` -static `gnome-config --libs-only-l applets` -g

# defines to be set for debugging/verbose ouput

#DEFINES=-DUSE_GNOME -DCALL_TRACE -DVERBOSE_OUTPUT
#CFLAGS=-Wall `gnome-config --cflags applets` $(DEFINES) $(INCLUDES) -g
#LFLAGS=`gnome-config --libs applets` -g
# the following line worked on RedHat 7.0
#SLFLAGS=-L/usr/lib -L/usr/X11R6/lib -lpanel_applet -lgnorba -lORBitCosNaming -lORBit -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXi -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl -g
# the following line worked on RedHat 6.1
#SLFLAGS=-static -L/usr/lib -L/usr/X11R6/lib -lpanel_applet -lgnorba -lORBitCosNaming -lIIOP -lORBitutil -lnsl -lgnomeui -lart_lgpl -lgdk_imlib -lSM -lICE -lgtk -lgdk -lgmodule -lXext -lX11 -lgnome -lgnomesupport -lesd -laudiofile -lm -ldb1 -lglib -ldl -g

# end of debug defines

MANCC=groff
MANCCFLAGS=-t -man -Tascii

GOBJS=gnome/session.o\
	gnome/properties.o\
	gnome/gplextor-tool.o\
	gnome/scsi-functions.o\
	gnome/utility-functions.o\
	common/common-functions.o

COBJS=console/cplextor-tool.o\
	common/common-functions.o

LSMPOBJS=console/ls_mode_pages.o\
	common/common-functions.o

DEP=makedepend

RM=rm
STRIP=strip

all:	plextor-tool pt-static plextor-tool-applet pta-static plextor-tool.8.gz strip

plextor-tool.8.gz:	../doc/plextor-tool.groff
	$(MANCC) $(MANCCFLAGS) ../doc/plextor-tool.groff > plextor-tool.8
	$(RM) -f plextor-tool.8.gz
	gzip plextor-tool.8

plextor-tool:	$(COBJS)
	$(CC) -o $@ $(COBJS)

pt-static:	$(COBJS)
	$(CC) -static -o $@ $(COBJS)

ls_mode_pages:	$(LSMPOBJS)
	$(CC) -o $@ $(LSMPOBJS)

plextor-tool-applet:	$(GOBJS)
	$(CC) -o $@ $(LFLAGS) $(GOBJS)

pta-static:	$(GOBJS)
	$(CC) -static -o $@ $(GOBJS) $(SLFLAGS)

strip:
	$(STRIP) plextor-tool
	$(STRIP) pt-static
	$(STRIP) plextor-tool-applet
	$(STRIP) pta-static

clean:
	rm -f plextor-tool-applet plextor-tool pta-static pt-static
	rm -f plextor-tool.8 core
	rm -f common/*.o gnome/*.o console/*.o .depend
	touch .depend

depend:	dep

dep:
	$(RM) -f .depend
	$(DEP) -- $(CFLAGS) -- gnome/*.c -f- > .depend
	$(DEP) -- $(CFLAGS) -- console/*.c -f- >> .depend
	$(DEP) -- $(CFLAGS) -- common/*.c -f- >> .depend
#	$(CC) $(CFLAGS) -MM console/*.c > .depend
#	$(CC) $(CFLAGS) -MM gnome/*.c >> .depend
#	$(CC) $(CFLAGS) -MM common/*.c > common/.depend
#	makedepend $(CFLAGS) gnome/*.c -f .depend

sdep:
	$(RM) -f .depend
	$(DEP) -- $(SCFLAGS) -- gnome/*.c -f- > .depend
	$(DEP) -- $(SCFLAGS) -- console/*.c -f- >> .depend
	$(DEP) -- $(SCFLAGS) -- common/*.c -f- >> .depend

ssdep:
	touch .depend

.SUFFIXES: .o .cpp
.cpp.o:
	$(CXX) $(CXXFLAGS) -c -o $@ $<

.SUFFEXES: .o .c
.c.o:
	$(CC) -c $(CFLAGS) -o $@ $<

include .depend
