#===============================================================
# V Makefile - Version 6/25/1996
#
# Copyright (C) 1995  Bruce E. Wampler
#
# This file is part of the V C++ GUI Framework, and is covered
# under the terms of the GNU Library General Public License,
# Version 2. This library has NO WARRANTY. See the source file
# vapp.cpp for more complete information about license terms.
#===============================================================

CC	=	g++

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

Arch = $(ARCH)

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


# Platform dependencies

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

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

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

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

#---------------------------------------------------------------------
# sgi - unm
ifeq ($(Arch),sgi)
HOMEV	=	/..
X11INC	=	/usr/include
X11LIB	=	/usr/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)

# Location of sources and inputs


# Flags for includes and libraries

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

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

# Directory stuff

TestObjs =	$(oDir)/testapp.o \
		$(oDir)/vtcanvas.o \
		$(oDir)/vtcmdwin.o \
		$(oDir)/vtcw2.o \
		$(oDir)/vttogdlg.o \
		$(oDir)/vtdialog.o

#---------------------------------------------------------------------
#
#	OK, the work begins here
#
#---------------------------------------------------------------------

$(Bin)/v1:	$(TestObjs)
	@echo "Linking V1"
	$(CC) -o $@ $(LFLAGS) $(TestObjs) $(LIBS)

#---------------------------------------------------------------------
#
#  .o's for the test file
#
#---------------------------------------------------------------------

$(oDir)/vtcanvas.o:	vtcanvas.cpp vtcanvas.h vcanvas.h vtextcnv.h vcanvas.h
	$(CC) -c $(CFLAGS) -o $@ $<                     

$(oDir)/vtdialog.o:	vtdialog.cpp vtdialog.h vdialog.h vcolor.h
	$(CC) -c $(CFLAGS) -o $@ $<                     

$(oDir)/vttogdlg.o:	vttogdlg.cpp vttogdlg.h vdialog.h vcolor.h
	$(CC) -c $(CFLAGS) -o $@ $<                     

$(oDir)/vtcmdwin.o:	vtcmdwin.cpp vtcmdwin.h vcmdwin.h bruce.vbm
	$(CC) -c $(CFLAGS) -o $@ $<                     

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

$(oDir)/testapp.o:	testapp.cpp testapp.h $(BASEDEP) vwindow.h vpane.h vcmdwin.h \
	vtcanvas.h vmenu.h vbtncmd.h vcbtncmd.h vlabelc.h \
	vframec.h vchkboxc.h vradioc.h vsliderc.h vtextinc.h vlistc.h vnotice.h \
	vprogrsc.h vfont.h vreply.h vtdialog.h vttogdlg.h vfilesel.h \
	vtextcnv.h vcomboc.h vtextc.h
	$(CC) -c $(CFLAGS) -o $@ $<
	chmod 755 $@
