# Here are some options you might want to adjust.  Some alternative 
# options are commented out

# When you do 'make install', the DESTDIR will be used as a prefix for 
# all installed file paths (i.e. you could set this to a temp directory
# to check things out.
DESTDIR=

# When you do 'make install', the files will be installed into the directory
# tree beginning with PREFIX, except the files which are installed  under /etc.
PREFIX = /usr/local
#PREFIX = /usr

# Compile either with debugging info or without
mode = release
#mode = debug

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

bindir = ${DESTDIR}${PREFIX}/bin
appletdir = ${DESTDIR}${PREFIX}/share/applets/Monitors
corbadir = ${DESTDIR}/etc/CORBA/servers
docdir = ${DESTDIR}${PREFIX}/doc/gsysinfo
helpdir  = ${DESTDIR}${PREFIX}/share/gnome/help/gsysinfo_applet/C
icondir = ${DESTDIR}${PREFIX}/share/pixmaps

ccFlags_release = -O3
ccFlags_debug = -g -DDEBUG

gnomeccFlags = `gnome-config --cflags --libs-only-L gtk gnome gnorba`
ccFlags = ${ccFlags_${mode}} -c ${gnomeccFlags}

ldFlags_release = -s 
ldFlags_debug = 
ldFlags = ${ldFlags_${mode}} `gnome-config --libs-only-L gnomeui gnorba gtk` --no-demangle

ldLibs = -lgtk -lgdk -lgnome -lgnomesupport -lgnomeui -lpanel_applet -lart_lgpl -lgnorba 

srcs = gsysinfo.c properties.c session.c sysinfo.c gauge.c color.c \
	gaugeprops.c

objs = ${srcs:.c=.o}

target = gsysinfo_applet


${target}: ${objs}
	g++ ${ldFlags} $^ ${ldLibs} -o $@


%.o: %.c
	g++ ${ccFlags} $< -o $@

.PHONY: clean

clean:
	rm -f ${objs} ${target} .depend
	rm -f *~


install: ${target}
	install -d ${bindir}
	install -d ${appletdir}
	install -d ${corbadir}
	install -d ${docdir}
	install -d ${icondir}
	install -d ${helpdir}
	install -c -m755 ${target} ${bindir}/${target}
	install -c -m644 ${target}.gnorba ${corbadir}/${target}.gnorba
	install -c -m644 ${target}.desktop ${appletdir}/${target}.desktop
	install -c -m644 gnome-gsysinfo.png ${icondir}/gnome-gsysinfo.png
	install properties-0.html ${helpdir}/properties-0.html
	install properties-1.html ${helpdir}/properties-1.html
	install properties-2.html ${helpdir}/properties-2.html
	cp README ${docdir}
	cp LICENSE ${docdir}

.depend:
	g++ ${ccFlags} -M ${srcs} > .depend

include .depend
