INCLUDE = `pkg-config --cflags gthread-2.0` `pkg-config --cflags gtk+-2.0` -Ilibusb
LIBS = `pkg-config --libs gthread-2.0` `pkg-config --libs gtk+-2.0`
export LOCALE_PACKAGE=mplinuxman
export LOCALE_DIR=/usr/local/share/locale
# remove -D NLS=1 if you want to disable international language support (gettext)
COMPILERFLAGS = -O -D MP_VERSION='"1.4"' -D PACKAGE='"$(LOCALE_PACKAGE)"' -D LOCALE_DIR='"$(LOCALE_DIR)"' -D NLS=1
CC = gcc
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)

HEADERFILES = dirdialog.h mplinux.h useful.h mputil3.h 
OBJECTFILES = dirdialog.o main.o mainwindow.o useful.o mp3util.o playlist.o waitdialog.o mplist.o miscwindow.o 

mplinuxman : $(OBJECTFILES) f60lib.o ini.o  usb.o error.o descriptors.o linux.o
	$(CC) -o mplinuxman $(CFLAGS) $(LIBS) $(OBJECTFILES) f60lib.o ini.o  usb.o error.o descriptors.o linux.o ; echo -e "\nDone\nTo install language translations use: make install-po" 


f60lib.o : f60lib/f60lib.c
	$(CC) -c $(CFLAGS) f60lib/f60lib.c

ini.o	: ini/ini.c
	$(CC) -c $(CFLAGS) ini/ini.c

linux.o : libusb/linux.c
	$(CC) -c $(CFLAGS) libusb/linux.c

descriptors.o : libusb/descriptors.c
	$(CC) -c $(CFLAGS) libusb/descriptors.c

error.o : libusb/error.c
	$(CC) -c $(CFLAGS) libusb/error.c

usb.o : libusb/usb.c
	$(CC) -c $(CFLAGS) libusb/usb.c


$(OBJECTFILES) :  %.o: %.c
	$(CC) -c $(CFLAGS)  $<

clean:
	rm mplinuxman *.o *~ ; exit 0

#create message template file mplinuxman.pot in the po dir, then merge in any changes to the translated message files in po dir
pot:
	xgettext  -k_ -kN_ -ppo -o mplinuxman.pot main.c dirdialog.c miscwindow.c mainwindow.c waitdialog.c
	cd po;\
	for name in `find *.po 2> /dev/null`; do\
		msgmerge -o tmp $$name mplinuxman.pot ;\
		mv tmp $$name;\
	done;\
	
#compile/install all translated message files in po dir
install-po:
	sh  po/install.sh
	

