#
#   ./axl/Makefile		- Makefile for the AX25 Listener.
#
#   Darryl Miles (G7LED)
#
TARGETS	=	axl
SRCS	=	axl.c
OBJS	=	axl.o

#include ../Makefile.xtra

CFLAGS	:=	$(CFLAGS) #-DLIBAX25

all:		$(TARGETS)

axl:		$(OBJS)
		$(CC) $(LDFLAGS) $(LIBDIR) -o $@ $^ $(LIBS)

install:	$(TARGETS)
		@if [ "$$LOGNAME" != "root" ] ; \
		then \
			echo "You must be 'root' to install this package."; \
			exit 1; \
		fi
		@if [ -f $(ETCDIR)/axl ] ; \
		then \
			echo "Backing up OLD 'axl' binary to $(ETCDIR)/axl.old"; \
			mv -f $(ETCDIR)/axl $(ETCDIR)/axl.old; \
		fi
		@echo "Installing 'axl' to $(ETCDIR)/axl"
		@install -o bin -g bin -m 0664 axl $(ETCDIR)
		@if [ ! -f $(ETCDIR)/ax25d ] ; \
		then \
			echo "Installing SAMPLE $(ETCDIR)/ax25d config file."; \
			echo "NOTE - You *must* edit this file to reflect your own system setup."; \
			install -o bin -g bin -m 0664 ax25d $(ETCDIR); \
		else \
			echo "$(ETCDIR)/ax25d exists, leaving original intact."; \
			echo "NOTE - Please *check* the format has not changed with the example"; \
			echo "       provided."; \
		fi

dep depend:
		$(MKDEP) $(CFLAGS) $(INCDIR) $(SRCS) >depend

clean:
		rm -f core *~ $(TARGETS) $(OBJS)

.c.o:
		$(CC) -c $(CFLAGS) $(INCDIR) -o $@ $<

###
ifeq (depend,$(wildcard depend))
   include depend
endif
