#=======================================================================
#  Makefile for example V draw program
#  Copyright (C) 1995  Bruce E. Wampler
#
#  This program is part of the V C++ GUI Framework example programs.
#
#  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
#  (see COPYING) along with this program; if not, write to the Free
#  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=======================================================================


CC	=	g++

#	default arch is intel
ARCH	= intel
#ARCH	= sun4
#ARCH	= mips

Arch = $(ARCH)

ifeq ($(Arch),i586)
Arch = intel
endif
ifeq ($(Arch),i486)
Arch = intel
endif


# Platform dependencies

HOMEV	=	..

# Linux
ifeq ($(Arch),intel)
X11INC	=	/usr/X11/include
X11LIB	=	/usr/X11R6/lib
LIBS	=	-lV -lXaw -lXmu -lXt -lXext -lX11
endif

# Linux elf
ifeq ($(Arch),intel)
X11INC	=	/usr/X11/include
X11LIB	=	/usr/X11R6/lib
LIBS	=	-lV -lXaw -lXmu -lXt -lXext -lX11 -lstdc++
endif

# Sun4 - unm
ifeq ($(Arch),sun4)
X11INC	=	/usr/local/X11/include
X11LIB	=	/usr/local/X11/lib
LIBS	=	-lV -lXaw -lXmu -lXt -lXext -lX11
endif

# mips - unm
ifeq ($(Arch),mips)
X11INC	=	/usr/local/X11/include
X11LIB	=	/usr/local/X11/lib
LIBS	=	-lV -lXaw -lXmu -lXt -lXext -lX11
endif

VPATH	=	../include

# Architecture dependent

VLibDir	=	$(HOMEV)/lib/$(Arch)

oDir	=	../obj/$(Arch)

LibDir	=	../lib/$(Arch)

Bin	=	../bin/$(Arch)


#--------------------------------------------------------------
# Architecture dependent

# Flags for includes and libraries

CFLAGS	=	-O -I$(X11INC) -I$(HOMEV)/includex

LFLAGS	=	-O -L$(X11LIB) -L$(VLibDir)

EXOBJS	=	$(oDir)/drawapp.o \
		$(oDir)/drawcnv.o \
		$(oDir)/drawcmdw.o

$(Bin)/vdrawex:	$(EXOBJS)
	$(CC) -o $@ $(LFLAGS) $(EXOBJS) $(LIBS)

objs:	$(EXOBJS)

$(oDir)/drawcnv.o:	drawcnv.cpp v_defs.h drawcnv.h
	$(CC) -c $(CFLAGS) -o $@ $<                     

$(oDir)/drawcmdw.o:	drawcmdw.cpp v_defs.h drawcmdw.h
	$(CC) -c $(CFLAGS) -o $@ $<                     

$(oDir)/drawapp.o:	drawapp.cpp v_defs.h drawapp.h drawcmdw.h drawcnv.h
	$(CC) -c $(CFLAGS) -o $@ $<
