##############################################################################
#
#                           Makefile for GPStrans
#
##############################################################################
#
# Make you changes here, you don't need to change Makefiles in the sub-dir's
#
##############################################################################
CC	= gcc
#
# use -DHPUX    for HPUX
#CFLAGS  = -g -DHPUX -I/usr/remote/X11R5/include -I/usr/remote/xview3.2/include
#LDFLAGS = -L/usr/remote/X11R5/lib -L/usr/remote/xview3.2/lib -lxview -lolgx -lX11 -lm
#
# use -DSUNOS41 for SunOS 4.1.x with XView 3.2 and X11R6
CFLAGS	= -g -DSUNOS41 -I/usr/X11/include 
LDFLAGS	= -L/usr/X11/lib -lxview -lolgx -lX11 -lm


##############################################################################
# Nothing need to be changed below this line.
##############################################################################
INCLUDES= -Iinclude
OFILES	= util.o event.o prefs.o graph.o file.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/gridutils.o


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

all:	$(OFILES) $(HFILES)
	@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 xgpstrans $(OFILES) $(XFILES) $(LDFLAGS)
	@echo "Linking file \"gpstrans\" static"
	@$(CC) -o xgpstrans-static $(OFILES) $(XFILES) -static $(LDFLAGS)

clean:
	@echo "Cleaning all in ./"
	@rm -f core gpstrans gpstrans-static *.o *.bak *~ #*#
	@echo "Cleaning all in ./gps"
	@(cd gps  ; make clean)
	@echo "Cleaning all in ./grid"
	@(cd grid ; make clean)



