#=======================================================================
#  Makefile for example V 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

#---------------------------------------------------------------------
# for hpux9.05 with gcc-2.7.2 Contributed by: Neal Becker <Neal.Becker@comsat.com>
#                             corrected by Jan Peter de Ruiter <janpeter@mpi.nl>
ifeq ($(Arch),hpux)
X11INC	=	/usr/include/X11R5
X11LIB	=	/usr/lib/X11R5
#the order of specification matters here!
LIBS    =       -lV -lXaw -lXmu -lXt -lSM -lICE -lXext -lX11
# old version - works on some systems
#LIBS	=	-lV -lXaw -lXmu -lXt -lXext -lX11
TARZ	=
RANLIB	=       true
endif

#-----------------------------------------------------------------
# solaris - unm
ifeq ($(Arch),solaris)
X11INC	=	/usr/local/X11/include
X11LIB	=	/usr/local/X11/lib
LIBS	=	-lV -lXaw -lXmu -lXt -lXext -lX11 -lnsl -lsocket
TARZ	=
RANLIB	=	true
endif

#-----------------------------------------------------------------
# FreeBSD with gcc
ifeq ($(Arch),bsd)
HOMEV   =       /home/wes/src
X11INC  =       /usr/X11R6/include
X11LIB  =       /usr/X11R6/lib
LIBS    =       -lV -lXaw -lXmu -lXt -lXext -lX11
TARZ    =
RANLIB  =       ranlib
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)/icondemo.o

$(Bin)/icondemo:	$(EXOBJS) $(VLibDir)/libV.a
	$(CC) -o $@ $(LFLAGS) $(EXOBJS) $(LIBS)

objs:	$(EXOBJS)

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