include ../config.make

distdir=bless-dist
MCS=mcs

BB_SRC=	ByteBuffer/ByteBuffer.cs \
	ByteBuffer/SegmentCollection.cs \
	ByteBuffer/Segment.cs \
	ByteBuffer/Buffer.cs \
	ByteBuffer/FileBuffer.cs \
	ByteBuffer/ChangeBuffer.cs
    
GUI_SRC= gui/MainWindow.cs \
	gui/DataView.cs \
	gui/Layout.cs	
	
GUI_AREAS_SRC=gui/areas/Area.cs \
	gui/areas/GroupedArea.cs \
	gui/areas/HexArea.cs \
	gui/areas/DecimalArea.cs \
	gui/areas/OctalArea.cs \
	gui/areas/OffsetArea.cs \
	gui/areas/SeparatorArea.cs \
	gui/areas/AsciiArea.cs \
	gui/areas/BinaryArea.cs 
	
GUI_DRAWERS_SRC=gui/drawers/Drawer.cs \
	gui/drawers/HexDrawer.cs \
	gui/drawers/DecimalDrawer.cs \
	gui/drawers/OctalDrawer.cs \
	gui/drawers/AsciiDrawer.cs \
	gui/drawers/BinaryDrawer.cs

 
GUI_DIALOGS_SRC= gui/dialogs/LayoutSelectionDialog.cs \
	gui/dialogs/SaveProgressDialog.cs \
	gui/dialogs/Alert.cs \
	gui/dialogs/ErrorAlert.cs \
	gui/dialogs/SaveConfirmationAlert.cs \
	gui/dialogs/FileOverwriteAlert.cs
	
UTIL_SRC= util/List.cs \
	util/Range.cs \
	util/TempFile.cs

MISC_DEPS= gui/bless.glade gui/default.layout

RESOURCES= -resource:gui/bless.glade,bless.glade \
	   -resource:gui/default.layout,default.layout    


bless.exe: $(GUI_SRC) $(BB_SRC) $(GUI_DRAWERS_SRC) $(GUI_AREAS_SRC) $(GUI_DIALOGS_SRC) $(UTIL_SRC) $(MISC_DEPS)
	$(MCS) -g -o bless.exe -t:exe -r:nunit.framework  $(RESOURCES) -pkg:gtk-sharp -pkg:glade-sharp \
	$(GUI_SRC) $(BB_SRC) $(GUI_DRAWERS_SRC)  $(GUI_AREAS_SRC) $(GUI_DIALOGS_SRC) $(UTIL_SRC)


%.dll:%.cs
	$(MCS) -t:library -r:nunit.framework -pkg:gtk-sharp $<

install: bless.exe 
	install -c -d $(PREFIX)/lib/bless
	install -c bless.exe $(PREFIX)/lib/bless
	echo "mono $(PREFIX)/lib/bless/bless.exe \"\$$@\"" > bless
	install -c -d $(PREFIX)/bin
	install -c bless $(PREFIX)/bin
	

uninstall:
	rm -rf $(PREFIX)/lib/bless
	rm $(PREFIX)/bin/bless
clean:
	rm -rf $(DLLS)
	
distdir:
	rm -rf ../$(distdir)/src
	mkdir ../$(distdir)/src
	cp --parents $(GUI_SRC) $(BB_SRC) $(GUI_DRAWERS_SRC) $(GUI_AREAS_SRC) \
	$(GUI_DIALOGS_SRC) $(UTIL_SRC) $(MISC_DEPS) Makefile ../$(distdir)/src/
