# Makefile.in for libirman.  Run `configure' to create `Makefile'.

SHELL = /bin/sh
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

.SUFFIXES:
.SUFFIXES: .c .o

.PHONY: clean install-dirs install-normal install-swtest dist

AR=ar
ARFLAGS = rc
RANLIB = @RANLIB@
CC = @CC@
TAR = tar

CFLAGS = @CFLAGS@
CPPFLAGS = -I. @CPPFLAGS@ @DEFS@
LDFLAGS = @LDFLAGS@ -L. -lirman
LDFLAGS_SW = @LDFLAGS@ -L. -lirman_sw
LIBS = @LIBS@
INSTALL = @INSTALL@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libdir = @libdir@
sysconfdir = @sysconfdir@
includedir = @includedir@

PROGS=test_io test_func test_name workmanir
PROGS_SW=test_func_sw test_name_sw workmanir_sw

IROBJS = chunk.o hashtable.o irio.o irfunc.o ircmd.o
IROBJS_SW = chunk.o hashtable.o irfunc_sw.o ircmd.o
IO_OBJS = test_io.o
FUNC_OBJS = test_func.o
NAME_OBJS = test_name.o
WORKMANIR_OBJS = workmanir.o

distdir = libirman-0.4.4
DISTFILES = COPYING COPYING.lib INSTALL NEWS README TECHNICAL TODO \
	    Makefile.in config.h.in configure.in stamp-h.in \
            configure install-sh mkinstalldirs \
            chunk.c chunk.h hashtable.c hashtable.h \
            ircmd.c irfunc.c irio.c irman.h \
            test_func.c test_io.c test_name.c workmanir.c \
            irman.conf

all: @NORMAL@

standard: libirman ${PROGS}

swtest: libirman_sw ${PROGS_SW}

both: standard swtest


libirman: libirman.a

libirman_sw: libirman_sw.a


test_io: libirman.a $(IO_OBJS)
	$(CC) $(IO_OBJS) -o test_io $(LDFLAGS)

test_func: libirman.a $(FUNC_OBJS)
	$(CC) $(FUNC_OBJS) -o test_func $(LDFLAGS)
test_func_sw: libirman_sw.a $(FUNC_OBJS)
	$(CC) $(FUNC_OBJS) -o test_func_sw $(LDFLAGS_SW)

test_name: libirman.a $(NAME_OBJS)
	$(CC) $(NAME_OBJS) -o test_name $(LDFLAGS)
test_name_sw: libirman_sw.a $(NAME_OBJS)
	$(CC) $(NAME_OBJS) -o test_name_sw $(LDFLAGS_SW)

workmanir: libirman.a $(WORKMANIR_OBJS)
	$(CC) $(WORKMANIR_OBJS) -o workmanir $(LDFLAGS)
workmanir_sw: libirman_sw.a $(WORKMANIR_OBJS)
	$(CC) $(WORKMANIR_OBJS) -o workmanir_sw $(LDFLAGS_SW)

libirman.a: $(IROBJS)
	$(AR) $(ARFLAGS) libirman.a $(IROBJS)
	$(RANLIB) libirman.a

libirman_sw.a: $(IROBJS_SW)
	$(AR) $(ARFLAGS) libirman_sw.a $(IROBJS_SW)
	$(RANLIB) libirman_sw.a

%.o: %.c irman.h config.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

ir%.o: ir%.c irman.h config.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

ircmd.o: ircmd.c irman.h config.h
	$(CC) $(CPPFLAGS) -DIR_SYSCONF_DIR=\"$(sysconfdir)\" -c $(srcdir)/ircmd.c -o ircmd.o
irfunc_sw.o: irfunc.c irman.h
	$(CC) $(CPPFLAGS) -DIR_SOFTWARE_TEST $(CFLAGS) -c $(srcdir)/irfunc.c -o irfunc_sw.o



install: @NORMAL@ install-dirs install-normal @INSTALL_SWTEST@
	@echo notice: the test programs are only installed in the current directory \(`pwd`\)

install-dirs:
	$(top_srcdir)/mkinstalldirs $(libdir)
	$(top_srcdir)/mkinstalldirs $(bindir)
	$(top_srcdir)/mkinstalldirs $(sbindir)
	$(top_srcdir)/mkinstalldirs $(includedir)
	$(top_srcdir)/mkinstalldirs $(sysconfdir)

install-normal:
	$(INSTALL) -m 755 workmanir $(bindir)/workmanir
	$(INSTALL) -m 755 libirman.a $(libdir)/libirman.a
	$(INSTALL) -m 644 irman.conf $(sysconfdir)/irman.conf
	$(INSTALL) -m 644 irman.h $(includedir)/irman.h

install-swtest:
	$(INSTALL) -m 755 workmanir $(bindir)/workmanir
	$(INSTALL) -m 755 libirman_sw.a $(libdir)/libirman_sw.a

uninstall:
	$(RM) $(bindir)/workmanir
	$(RM) $(bindir)/workmanir_sw
	$(RM) $(libdir)/libirman.a
	$(RM) $(libdir)/libirman_sw.a
	$(RM) $(sysconfdir)/irman.conf

dist:
	rm -rf $(distdir)
	mkdir $(distdir)
	cp $(DISTFILES) $(distdir)
	$(TAR) chozf $(distdir).tar.gz $(distdir)
	rm -rf $(distdir)

clean:
	$(RM) *.o *~ a.out core ${PROGS} ${PROGS_SW} libirman.a libirman_sw.a

distclean: clean
	$(RM) Makefile config.h config.status config.cache config.log stamp-h stamp-h.in

mostlyclean: clean

maintainer-clean: distclean

# rules to redo the configuration
${srcdir}/configure: configure.in
	cd ${srcdir} && autoconf

${srcdir}/config.h.in: stamp-h.in
${srcdir}/stamp-h.in: configure.in
	cd ${srcdir} && autoheader
	echo timestamp > ${srcdir}/stamp-h.in

config.h: stamp-h
stamp-h: config.h.in config.status
	./config.status

Makefile: Makefile.in config.status
	./config.status

config.status: configure
	./config.status --recheck
