all: plugin

PLUGIN = CDVDisoEFP.dll
CC = mingw32-gcc.exe

PLUGINOBJS = CDVDiso.o mainbox.o tablerebuild.o progressbox.o conversionbox.o \
	devicebox.o device.o DVD.o CD.o
PLUGINHEADERS = CDVDiso.h mainbox.h tablerebuild.h progressbox.h conversionbox.h \
	devicebox.h device.h DVD.h CD.h
PLUGINFLAGS = -Wall -O2 -D_WIN32 -D_LARGEFILE64_SOURCE -I.. -I. -I./Win32 -mwindows
PLUGINLIBS = -L./ -lcomctl32 -lwsock32 -lwinmm -lgdi32 -lcomdlg32 -lkernel32 \
	-luser32 --subsystem,windows
# Note: Don't think we need all the above libs... will pare down later.

SHAREDOBJS = ..\\version.o conf.o ..\\isofile.o actualfile.o logfile.o \
	..\\imagetype.o ..\\multifile.o ..\\isocompress.o ..\\convert.o \
	..\\gzipv1.o ..\\blockv2.o ..\\gzipv2.o ..\\bzip2v2.o ..\\ecma119.o \
	..\\toc.o ..\\ini.o ..\\bzip2v3.o \
	..\\zlib\\adler32.o ..\\zlib\\compress.o ..\\zlib\\crc32.o \
	..\\zlib\\gzio.o ..\\zlib\\uncompr.o ..\\zlib\\deflate.o \
	..\\zlib\\trees.o ..\\zlib\\zutil.o ..\\zlib\\inflate.o \
	..\\zlib\\infback.o ..\\zlib\\inftrees.o ..\\zlib\\inffast.o \
	..\\bzip2\\blocksort.o ..\\bzip2\\bzlib.o ..\\bzip2\\compress.o \
	..\\bzip2\\crctable.o ..\\bzip2\\decompress.o ..\\bzip2\\huffman.o \
	..\\bzip2\\randtable.o
SHAREDHEADERS = ..\\version.h conf.h ..\\isofile.h actualfile.h logfile.h \
	..\\imagetype.h ..\\multifile.h ..\\isocompress.h ..\\convert.h \
	..\\gzipv1.h ..\\blockv2.o ..\\gzipv2.h ..\\bzip2v2.h ..\\ecma119.h \
	..\\toc.h ..\\ini.h ..\\bzip2v3.o



WINDRES = windres.exe



release: plugin
	copy $(PLUGIN) ..\\..

plugin: $(PLUGINOBJS) $(SHAREDOBJS) screens.res
	-del $(PLUGIN)
	dllwrap --def plugin.def -o $(PLUGIN) $(PLUGINOBJS) screens.res $(SHAREDOBJS) $(PLUGINLIBS)
	strip --strip-unneeded --strip-debug $(PLUGIN)

$(PLUGINOBJS) $(SHAREDOBJS): %.o: %.c
	$(CC) $(PLUGINFLAGS) -c $< -o $@

screens.res: screens.rc
	$(WINDRES) -i screens.rc -J rc -o screens.res -O coff

.PHONY : clean allclean
clean:
	-del $(PLUGINOBJS) $(PLUGIN) $(SHAREDOBJS) screens.res

allclean:
	-del $(PLUGINOBJS) $(PLUGIN) $(SHAREDOBJS) screens.res
	-del temp.txt err.txt ..\\temp.txt ..\\err.txt
	-del ..\\..\\$(PLUGIN)

