#
#  Copyright (C) 2000-2002  Henk de Groot - PE1DNN
#
#  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., 675 Mass Ave, Cambridge, MA 02139, USA.
#  Please note that the GPL allows you to use the driver, NOT the radio.
#  In order to use the radio, you need a license from the communications
#  authority of your country.
#
DIGI_NED = 0.3.2

# if using the _NEW_ AX25 Utils this next line should be uncommented.      
DEFS = -DNEW_AX25

# if satellite tracker needs to be excluded then comment the next line
DEFS += -D_SATTRACKER_

# if telemetry stuff needs to be excluded then comment the next line
DEFS += -D_TELEMETRY_

# if weather stuff needs to be excluded then comment the next line
DEFS += -D_WX_

# if port-output stuff needs to be excluded then comment the next line
DEFS += -D_OUTPORT_

# if the serial-input stuff needs to be excluded then comment the next line
DEFS += -D_SERIAL_

RM = rm 
ECHO = echo -n -e
# Use this when debugging with GDB
#CC = gcc -O -ggdb -Wall
# Use this to generate a finite version
CC = gcc -O6

DEBUG = -g -Wall -Wstrict-prototypes -Wunused

INCLUDES= -I./ -I/usr/include -I/usr/local/include
LIBS    = -lm -lax25 -L/usr/local/lib -L/usr/lib/
DEFS    += -D_LINUX_
CFLAGS  = -c $(INCLUDES) $(DEFS)

PROGRAMS = call.o digipeat.o genlib.o keep.o main.o message.o preempt.o \
	mheard.o distance.o dx.o output.o read_ini.o send.o timer.o \
	telemetr.o command.o mac_if.o linux.o predict.o sat.o serial.o wx.o
PROGS = call.c digipeat.c genlib.c keep.c main.c message.c preempt.c \
	mheard.c distance.c dx.c output.c read_ini.c send.c timer.c \
	telemetr.c command.c mac_if.c linux.c predict.c sat.c serial.c wx.c

all: digi_ned

digi_ned: version.h $(PROGRAMS)
	$(CC) -o $@ $(PROGRAMS) $(LIBS)

tar: clean
	cd ..;tar czf digi_ned-$(DIGI_NED).tgz digi_ned

clean:
	-makedepend
	-$(RM) -f *.o core digi_ned *.bak *.orig *.log *.tnc *.dec backup.zip

depend:
	makedepend $(DEFS) -- $(INCLUDES) -- $(PROGS)

version.h: Makefile
	@echo "Creating version.h and version.bat in DOS format"
	@$(ECHO) "#define VERSION \"$(DIGI_NED)\"\r\n" > version.h
	@$(ECHO) "set archive=dnexe"`echo $(DIGI_NED) | tr -d "."`".zip\r\n" \
		> version.bat

# DO NOT DELETE
