##############################################################################
#
#                Makefile for the ascii-version of GPStrans
#
##############################################################################
#
# Make changes here, and you don't need to change Makefiles in the sub-dir's
#
##############################################################################
CC	= gcc

# use -DSUNOS41 for SunOS 4.1.x
# usr -DHPUX    for HPUX
CFLAGS	= -Wall -g -D__LINUX__
# -O3
LDFLAGS	= -lm


##############################################################################
# Nothing need to be changed below this line.
##############################################################################
INCLUDES= -Iinclude -Igetline
OFILES	= util.o prefs.o graph.o main.o
HFILES  = include/defs.h include/Prefs.h include/Garmin.h\
          include/icon.icon include/gpstrans.icon

XFILES	= gps/sendgpsinfo.o gps/dms.o gps/datum.o \
	  gps/calendar.o gps/gpsmessage.o gps/garmincomm.o \
	  gps/garminserial.o gps/getgpsinfo.o gps/latlong.o	\
	  grid/itm.o grid/bng.o grid/tm.o grid/ups.o \
	  grid/utm.o grid/seg.o grid/gridutils.o grid/kkj.o \
	  grid/gkk.o getline/libgetline.a \


.c.o:	$(HFILES)
	$(CC) -c $(CFLAGS) $(INCLUDES) $<

all:	$(OFILES) $(HFILES)
	@echo "Making all in ./getline"
	@(cd getline ; make libgetline.a)
	@echo "Making all in ./gps"
	@(cd gps  ; make all CC="$(CC)" CFLAGS="$(CFLAGS)")
	@echo "Making all in ./grid"
	@(cd grid ; make all CC="$(CC)" CFLAGS="$(CFLAGS)")
	@echo "Linking file \"gpstrans\""
	$(CC) -o gpstrans $(OFILES) $(XFILES) $(LDFLAGS)

