###############################################################################
#                                                                  
#Copyright (C) 2002,2003 Emil D. Kohn   emild@cs.technion.ac.il     
#                                                                  
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
###############################################################################

TARGET = adsl-up
INSTALL_DIR=/usr/local/bin
CC=gcc
DEBUG=-g
CFLAGS=$(DEBUG) -D_REENTRANT
LDFLAGS=-static $(DEBUG)
LIBS=-lusb -lpthread
OBJS = adsl-up.o sar.o atm_crc.o ppp_crc16.o pppd_io.o
LIBUSB = -lusb

$(TARGET): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

.PHONY: clean
clean:
	rm -f $(OBJS) $(TARGET) *~ core*


.PHONY: install
install:
	mkdir -p $(INSTALL_DIR)
	cp $(TARGET) $(INSTALL_DIR)
	cp startadsl $(INSTALL_DIR)

TARBALL_FILES=adsl-up.c atm_crc.c  ppp_crc16.c  pppd_io.c  sar.c\
		firmware_data.h firmware_info.h line_status_data.h\
		line_status_info.h setup_data.h setup_info.h\
		atm_crc.h defs.h ppp_crc16.h pppd_io.h sar.h\
		options.sample pap-secrets.sample\
		COPYING README apache_ab-dsl-c.jpg Makefile



.PHONY: tarball
tarball:
	TMP_DIR=`mktemp -d /tmp/ADSL-UP.XXXXXX`;\
	 mkdir -p $${TMP_DIR}/adsl-up-0.1;\
	 cp $(TARBALL_FILES) $${TMP_DIR}/adsl-up-0.1;\
	 cd $${TMP_DIR}; tar cfvz adsl-up-0.1.tar.gz adsl-up-0.1; cd -;\
	 cp $${TMP_DIR}/adsl-up-0.1.tar.gz .;\
	 rm -rf $${TMP_DIR}
