# $Id: Makefile.in,v 1.2 1999/03/29 11:05:23 armin Exp $
#
# Makefile for eiconctrl
# (C) 1997 Fritz Elfert
# (C) 1998,99 Armin Schindler
# (C) 1999 Cytronics & Melware
#
#
SHELL			= /bin/sh
CFLAGS			= -Wall -O2
INCLUDES		= -I. -I@CONFIG_KERNELDIR@/include -I@CONFIG_KERNELDIR@/drivers/isdn/eicon
DEFS			=
LDFLAGS			= -L../lib @LIBS@ -lncurses
PROGRAM			= eiconctrl
MODULES			= eiconctrl.o
MANPAGE			= eiconctrl.8
INSTALL			= @INSTALL@
SBINDIR			= @CONFIG_SBINDIR@
DATADIR			= @CONFIG_DATADIR@
MANDIR			= @CONFIG_MANDIR@
MAN8DIR			= $(MANDIR)/man8
INSTALL_PROGRAM	= $(INSTALL) -o 0 -g 0 -m 0750
INSTALL_DATA	= $(INSTALL) -o 0 -g 0 -m 0644
INSTALL_MAN		= $(INSTALL) -o 0 -g 0 -m 0644
CC				= @CC@
COPTS			= -D__DATADIR__=\"$(shell echo $(DESTDIR)$(CONFIG_DATADIR))\"

ifeq ("@CONFIG_EICONCTRL_DEBUG@","y")
	COPTS		+= -D__DEBUGVAR__
endif

.SUFFIXES:
.SUFFIXES: .c .o

%.o: %.c Makefile
	$(CC) $(CFLAGS) $(INCLUDES) $(DEFS) $(COPTS) -c -o $@ $<

all: $(PROGRAM)

config:
	@./configure

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

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

$(PROGRAM):	$(MODULES)
	$(CC) $(CFLAGS) $(INCLUDES) $(DEFS) $? $(LDFLAGS) -o $@

install-data:
	mkdir -p $(DESTDIR)$(DATADIR)
	tar xpvCfz $(DESTDIR)$(DATADIR) firmware/eicon_firm.tgz

install-man: $(PROGRAM).man
	mkdir -p $(DESTDIR)$(MAN8DIR)
	$(INSTALL_MAN) $< $(DESTDIR)$(MAN8DIR)/$(MANPAGE)

install: $(PROGRAM) install-man install-data
	$(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(SBINDIR)/$(PROGRAM)

install-strip: $(PROGRAM)
	$(INSTALL_PROGRAM) -s $(PROGRAM) $(DESTDIR)$(SBINDIR)/$(PROGRAM)

uninstall:
	rm -f $(DESTDIR)$(SBINDIR)/$(PROGRAM) $(DESTDIR)$(MAN8DIR)/$(MANPAGE)

clean:
	rm -f *.o *~ $(PROGRAM)

distclean: clean
	rm -f config.status config.cache config.log Makefile eiconctrl.man
