#Default flags
CC=gcc
CFLAGS=-fPIC -shared -O2 -Wall -Werror 
LIBS=-lpthread

#Define library directory
#For Debian 64bit: LIBDIR=/emul/ia32-linux/usr/lib 
LIBDIR=/usr/lib

#ALSA INSIDE FLASH PLAYER
#To make auto-detection use Flash's internal ALSA functions
#instead of libflashsupport external ALSA functions (recommended)
ALSA=-DALSA_INTERNAL

#ALSA CUSTOM
#To use libflashsupport built-in ALSA functions. This is redundant as Flash 
#already has ALSA support and is only needed if you need special 
#modifications. It will also require the alsa headers and libraries.
#ALSALIBS=-lalsatoss -laoss -lasound
#ALSA=-DALSA

#PULSE AUDIO
LIBPULSEPATH=-DLIBPULSEPATH='"$(LIBDIR)/libpulse-simple.so.0"'
PULSE=-DPULSEAUDIO

#ESD
LIBESDPATH=-DLIBESDPATH='"$(LIBDIR)/libesd.so.0"'
ESD=-DESD

#OSS
OSS=-DOSS

#OPENSSL
SSL=-DOPENSSL
SSLLIBS=-lssl

#GNUTLS 
#SSL=-DGNUTLS
#SSLLIBS=-lgnutls

#V4L1
#V4L=-DV4L1

#Obsolete, but keep in makefile in case it gets back in
#ICULIBS=-licuuc



all: libflashsupport.so

libflashsupport.so: flashsupport.c
	$(CC) $(CFLAGS) $(LIBS) -DLIBDIR=$(LIBDIR) \
	$(ALSA) $(ALSALIBS) $(PULSE) $(LIBPULSEPATH) $(ESD) $(LIBESDPATH) \
	$(OSS) $(SSL) $(SSLLIBS) $(V4L) $(ICULIBS)\
	flashsupport.c -o libflashsupport.so

install: all
	mkdir -p ${LIBDIR}
	install -m 755 libflashsupport.so ${LIBDIR}

sudoinstall: all	                
	sudo mkdir -p ${LIBDIR}
	sudo install -m 755 libflashsupport.so ${LIBDIR}

clean:
	rm -f libflashsupport.so *~ *.o
