# Makefile for libiconv/lib, OS2/EMX specific
#
#	requires EMX/GCC development environment and
#	GNU fileutils and GNU textutils installed
#
#	define EMXPATH=<your EMX path> on install/uninstall
#

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

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

# Programs used by "make":
CC = gcc
CFLAGS = -O2 -Zomf -Zcrtdll -Zmt
INCLUDES = -I. -I../include

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

.SUFFIXES: .obj .o

SOURCES = iconv.c

OBJECTS = iconv.obj

all : iconv.dll iconv.a iconv.lib

config.h : force
	sed -e 's/#undef WORDS_LITTLEENDIAN$$/#define WORDS_LITTLEENDIAN 1/' < config.h.in > config.h

iconv.obj : iconv.c encodings.def encodings_local.def aliases.h config.h
	$(CC) $(INCLUDES) $(CFLAGS) -c iconv.c

iconv.dll : $(OBJECTS) ../os2/iconv.def # DLL itself
	$(CC) -Zdll $(CFLAGS) -o $@ $(OBJECTS) ../os2/iconv.def

iconv.lib : ../os2/iconv.def            # Import Lib. for -Zomf
	rm -f iconv.lib
	emximp -o iconv.lib ../os2/iconv.def

iconv.a : ../os2/iconv.def              # Import Lib. for EMX .o format
	rm -f iconv.a
	emximp -o iconv.a ../os2/iconv.def

# 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
	cp -i iconv.dll $(shlibdir)/iconv.dll
	cp -i iconv.lib $(libdir)/iconv.lib
	cp -i iconv.a   $(libdir)/iconv.a

install : all force
	cp -i iconv.dll $(shlibdir)/iconv.dll
	cp -i iconv.lib $(libdir)/iconv.lib
	cp -i iconv.a   $(libdir)/iconv.a

uninstall : force
	rm -f $(shlibdir)/iconv.dll
	rm -f $(libdir)/iconv.lib
	rm -f $(libdir)/iconv.a

check : all

clean : force
	rm -f *.obj *.lib *.a *.dll core

distclean : clean
	rm -f config.h

maintainer-clean : distclean

force :
