# -*- makefile -*-

!name ick-proxy

!makefile unix Makefile
!makefile vc Makefile.vc
!makefile osx Makefile.osx

PROXY = proxy icklang malloc tree234

ick-proxy : [G] wintray wintray.res PROXY
          + user32.lib gdi32.lib wsock32.lib shell32.lib
ick-proxy : [U] unix uxcommon PROXY X11.lib
ick-proxy : [MU] unix[NO_X11] uxcommon PROXY
ick-proxy : [MX] osx osx.icns osx-info.plist uxcommon PROXY

# Makefile fragment for the documentation.
!begin unix
doc: ick-proxy.1 unixdoc.html guidoc.html
ick-proxy.1: manpage0.but icklang.but manpage1.but
	halibut --man=ick-proxy.1 manpage0.but icklang.but manpage1.but
unixdoc.html: manpage0.but icklang.but manpage1.but
	halibut --html=unixdoc.html manpage0.but icklang.but manpage1.but
guidoc.html: gui0.but icklang.but gui1.but
	halibut --html=guidoc.html gui0.but icklang.but gui1.but
!end

# Makefile fragment to build the OS X .dmg release archive.
!begin osx
release: ick-proxy.dmg
ick-proxy.dmg: ick-proxy-application
	rm -f raw.dmg
	hdiutil create -megabytes 5 -layout NONE raw.dmg
	hdid -nomount raw.dmg > devicename
	newfs_hfs -v "ick-proxy distribution image" `cat devicename`
	hdiutil eject `cat devicename`
	hdid raw.dmg | cut -f1 -d' ' > devicename
	cp -R ick-proxy.app /Volumes/"ick-proxy distribution image"
	hdiutil eject `cat devicename`
	rm -f ick-proxy.dmg
	hdiutil convert -format UDCO raw.dmg -o ick-proxy.dmg
	rm -f raw.dmg devicename
!end

# Unix `make install' target.
!begin unix
install: ick-proxy ick-proxy.1
	-mkdir -p $(bindir)
	$(INSTALL_PROGRAM) ick-proxy $(bindir)/ick-proxy
	-mkdir -p $(man1dir)
	$(INSTALL_DATA) ick-proxy.1 $(man1dir)/ick-proxy.1
!end
