#
# Makefile for Interface
#
# $Id: Makefile,v 1.32 2004/11/02 21:33:32 graziano Exp $
#

# include common variables
include ../Makedefs

# object created here
OBJS	=		$(buildobjdir)/add_forecast.o \
			$(buildobjdir)/nws_ctrl.o \
			$(buildobjdir)/halt_activity.o \
			$(buildobjdir)/nws_extract.o \
			$(buildobjdir)/nws_insert.o \
			$(buildobjdir)/nws_search.o \
			$(buildobjdir)/start_activity.o \
			$(buildobjdir)/whattime.o \
			$(buildobjdir)/nws_ping.o 

# library we depend upon
DEP_LIB	=		$(buildlibdir)/$(LIBNWSNAME)

# the programs we are building and aliases
PROGRAMS	=	$(buildbindir)/add_forecast \
			$(buildbindir)/nws_ctrl \
			$(buildbindir)/halt_activity \
			$(buildbindir)/nws_extract \
			$(buildbindir)/nws_insert \
			$(buildbindir)/nws_search \
			$(buildbindir)/start_activity \
			$(buildbindir)/whattime \
			$(buildbindir)/nws_ping 

SCRIPTS		=	$(buildbindir)/html-hosts \
			$(buildbindir)/nws-hostadmin

.PHONY: all clean dist install

all: $(OBJS) $(PROGRAMS) $(SCRIPTS)

clean:
	@$(RM) -f $(OBJS)

dist:
	@$(INSTALL) -d $(DIST_ROOT)/Interface
	@$(CP)  Makefile *.1 *.c html-hosts nws-hostadmin $(DIST_ROOT)/Interface

install:
	@echo "Installing user commands ..."
	@$(CP) $(PROGRAMS) $(bindir)
	@$(CP) $(SCRIPTS) $(bindir)
	@echo "Installing man pages for user commands ..."
	@$(CP) *.1 $(mandir)/man1

$(buildbindir)/html-hosts: html-hosts
	$(INSTALL) html-hosts $(buildbindir)/html-hosts

$(buildbindir)/nws-hostadmin: nws-hostadmin
	$(INSTALL) nws-hostadmin $(buildbindir)/nws-hostadmin

# Compilation rules for C.
$(buildobjdir)/%.o : %.c $(buildincdir)/*.h ../Include/*.h
	$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@

# Linking rules
$(buildbindir)/% : $(buildobjdir)/%.o $(DEP_LIB)
	$(CC) -o $@ $< $(LDFLAGS) $(DEP_LIB)
