# Makefile for libiconv, for OS2/EMX
#

#### Start of system configuration section. ####

# Directories used by "make install":
prefix = @prefix@
exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib
shlibdir = $(exec_prefix)/dll
includedir = $(prefix)/include
mandir = $(prefix)/man

#### End of system configuration section. ####

all : force
	sed -e 's/@ICONV_CONST@/const/g' < include/iconv.h.in > include/iconv.h
	(cd lib   && $(MAKE) -f Makefile.os2 all && cd ..)
	(cd src   && $(MAKE) -f Makefile.os2 all && cd ..)
	(cd man   && $(MAKE) -f Makefile.os2 all && cd ..)
	(cd tests && $(MAKE) -f Makefile.os2 all && cd ..)

# Installs the library and include files only. Typically called with only
# $(libdir), $(shlibdir) and $(includedir) - don't use $(prefix) and
# $(exec_prefix) here.
install-lib : all force
	@echo install to $(libdir), $(shlibdir) and $(includedir)
	cp include/iconv.h $(includedir)/iconv.h
	(cd lib && $(MAKE) -f Makefile.os2 install-lib libdir='$(libdir)' shlibdir='$(shlibdir)' includedir='$(includedir)' && cd ..)
	
install : force
	@echo install to $(prefix)
	cp include/iconv.h $(includedir)/iconv.h
	(cd lib && $(MAKE) -f Makefile.os2 install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' shlibdir='$(shlibdir)' && cd ..)
	(cd src && $(MAKE) -f Makefile.os2 install prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' shlibdir='$(shlibdir)' && cd ..)
	(cd man && $(MAKE) -f Makefile.os2 install prefix='$(prefix)' exec_prefix='$(exec_prefix)' mandir='$(mandir)' && cd ..)

uninstall : force
	rm -i $(includedir)/iconv.h
	(cd lib && $(MAKE) -f Makefile.os2 uninstall prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' shlibdir='$(shlibdir)' && cd ..)
	(cd src && $(MAKE) -f Makefile.os2 uninstall prefix='$(prefix)' exec_prefix='$(exec_prefix)' libdir='$(libdir)' shlibdir='$(shlibdir)' && cd ..)
	(cd man && $(MAKE) -f Makefile.os2 uninstall prefix='$(prefix)' exec_prefix='$(exec_prefix)' mandir='$(mandir)' && cd ..)

check : all force
	(cd lib   && $(MAKE) -f Makefile.os2 check && cd ..)
	(cd src   && $(MAKE) -f Makefile.os2 check && cd ..)
	(cd man   && $(MAKE) -f Makefile.os2 check && cd ..)
	(cd tests && $(MAKE) -f Makefile.os2 check && cd ..)

mostlyclean : force
	(cd lib   && $(MAKE) -f Makefile.os2 mostlyclean && cd ..)
	(cd src   && $(MAKE) -f Makefile.os2 mostlyclean && cd ..)
	(cd man   && $(MAKE) -f Makefile.os2 mostlyclean && cd ..)
	(cd tests && $(MAKE) -f Makefile.os2 mostlyclean && cd ..)

clean : force
	(cd lib   && $(MAKE) -f Makefile.os2 clean && cd ..)
	(cd src   && $(MAKE) -f Makefile.os2 clean && cd ..)
	(cd man   && $(MAKE) -r Makefile.os2 clean && cd ..)
	(cd tests && $(MAKE) -r Makefile.os2 clean && cd ..)

distclean : force
	(cd lib   && $(MAKE) -f Makefile.os2 distclean && cd ..)
	(cd src   && $(MAKE) -f Makefile.os2 distclean && cd ..)
	(cd man   && $(MAKE) -f Makefile.os2 distclean && cd ..)
	(cd tests && $(MAKE) -f Makefile.os2 distclean && cd ..)
	rm -f include/iconv.h

maintainer-clean : force
	(cd lib   && $(MAKE) -f Makefile.os2 maintainer-clean && cd ..)
	(cd src   && $(MAKE) -f Makefile.os2 maintainer-clean && cd ..)
	(cd man   && $(MAKE) -f Makefile.os2 maintainer-clean && cd ..)
	(cd tests && $(MAKE) -f Makefile.os2 maintainer-clean && cd ..)
	rm -f include/iconv.h

force :
