#
# Makefile for HTMLDOC, an HTML document processing program.
#
# Copyright 2011-2017 by Michael R Sweet.
# Copyright 1997-2010 by Easy Software Products.
#
# This program is free software.  Distribution and use rights are outlined in
# the file "COPYING".
#

#
# Include common definitions...
#

include Makedefs


#
# Subdirectories...
#

DIRS	=	@JPEG@ @ZLIB@ @PNG@ htmldoc doc
INSTALLDIRS =	fonts data desktop doc htmldoc


#
# Make all targets...
#

all:
	for dir in $(DIRS); do\
		echo Making all in $$dir...;\
		(cd $$dir; $(MAKE) -$(MAKEFLAGS)) || exit 1;\
	done


#
# Remove object and target files...
#

clean:
	for dir in $(DIRS); do\
		echo Cleaning in $$dir...;\
		(cd $$dir; $(MAKE) -$(MAKEFLAGS) clean) || exit 1;\
	done


#
# Clean everything
#

distclean:	clean
	$(RM) -r autom4te*.cache
	$(RM) config.h
	$(RM) config.log
	$(RM) config.status
	$(RM) desktop/htmldoc.dt
	$(RM) desktop/htmldoc.plist
	$(RM) Makedefs
	$(RM) Makefile


#
# Install object and target files...
#

install:
	$(MAKE) all
	for dir in $(INSTALLDIRS); do\
		echo Installing in $$dir...;\
		(cd $$dir; $(MAKE) -$(MAKEFLAGS) install) || exit 1;\
	done


#
# Sign the HTMLDOC application bundle and make a disk image...
#

IDENTITY	=	"Developer ID Application: Michael Sweet (RU58A2256H)"
VERSION		=	@SVERSION@

dmg:
	echo Signing HTMLDOC application bundle
	codesign -s $(IDENTITY) htmldoc/htmldoc.app
	echo Making disk image...
	rm -f htmldoc-$(VERSION)-macos.dmg
	hdiutil create -srcfolder htmldoc/htmldoc.app htmldoc-$(VERSION)-macos.dmg
