# Makefile for utelnetd
# 
# Note: Modified to build under NASoC build environment. 6/25/2004.
#
# Configure this with the following environment variables:
#

# where to install
INSTALLDIR	= .

# GNU target string 
CROSS		:= mipsel-linux-

# where to find login program
ifneq ("", "$(BSD)")
LOGIN		:= /usr/bin/login
else
LOGIN		:= /bin/login
endif

ifneq ("", "$(BSD)")
CORE		:= utelnetd.core
else
CORE		:= core
endif

# nothing to configure below this line... ---8<---8<---8<---

PROGS     = utelnetd

INSTMODE  = 0755
INSTOWNER = root
INSTGROUP = root

OBJS      = utelnetd.o

CC        = $(CROSS)gcc
INSTALL   = install

CFLAGS	 += -I. -pipe -DSHELLPATH=\"$(LOGIN)\" -Wall

ifneq ("","$(DEBUG)")
CFLAGS   += -DDEBUG -g -Os
STRIP	  = \#
else
CFLAGS	 += -fomit-frame-pointer
STRIP	  = $(CROSS)strip 
endif

ifeq ("1", "$(BSD)")
CFLAGS   += -DBSD
endif


all: $(PROGS)

$(PROGS): $(OBJS)
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

.PHONY: install
install: $(PROGS)
	$(INSTALL) -D utelnetd $(INSTALLDIR)/bin/utelnetd
	$(STRIP) $(INSTALLDIR)/bin/utelnetd

.PHONY: clean
clean:
	rm -f $(PROGS) *.o $(CORE)
