# This makefile compiles lame_enc.dll with mingw32 (and possibly cygwin)
# Of course, you must first build ../libmp3lame/libmp3lame.a.
# liblame_enc.a can be used to link the lame_enc.dll to your programs.
# Tested with EAC 0.9pb9 (my own favorite, http://www.exactaudiocopy.de/)
# example.exe compiles and works, too.
#                                  Vladislav Naumov, <vnaum@inbox.ru>
#
# PS: to 'make clean' you need rm. MS's del is unusable.
# PPS: quick build:
#      make -fMakefile.mingw32

DLL_NAME = lame_enc
LAME_SRC_ROOT = ..
OFILES = BladeMP3EncDLL.o $(DLL_NAME)_exp.o
CFLAGS = -I$(LAME_SRC_ROOT)/include -I$(LAME_SRC_ROOT)/libmp3lame
CC = g++
LD = g++
DLLTOOL = dlltool
LFLAGS = -L$(LAME_SRC_ROOT)/libmp3lame/.libs -o $(DLL_NAME).dll -mdll -s
LIBS = -lmp3lame

all: $(DLL_NAME).dll example.exe

BladeMP3EncDLL.o: BladeMP3EncDLL.c BladeMP3EncDLL.h ../include/lame.h \
 ../libmp3lame/lame_global_flags.h ../libmp3lame/version.h

$(DLL_NAME).dll : $(OFILES)
	$(LD) $(LFLAGS) $(OFILES) $(LIBS)
	
$(DLL_NAME)_exp.o : BladeMP3EncDLL.o
	$(DLLTOOL) --input-def BladeMP3EncDLL.def --output-lib lib$(DLL_NAME).a --output-exp $(DLL_NAME)_exp.o --dllname $(DLL_NAME) BladeMP3EncDLL.o

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

example.exe : Example.cpp BladeMP3EncDLL.h
	$(CC) Example.cpp -o example.exe

clean :
	rm -f $(DLL_NAME).dll $(OFILES) example.exe
