#
# File:		makefile.unx
# Author:	Julian Smart
# Created:	1993
# Updated:	
# Copyright:	(c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile for hello example (UNIX).
# Change the WXDIR directory, and CPPFLAGS and LDFLAGS, for your system.

GUISUFFIX=_ol

CC = gcc-2.1

# Replace X include/lib directories with your own, e.g. -I/usr/openwin/include ...
XINCLUDE=-I/aiai/packages/motif1.2.1/motif/include -I/aiai/packages/X.V11R5/include
XLIB=-L/aiai/packages/motif1.2.1/motif/sun4/lib -L/aiai/packages/X.V11R5/lib

WXDIR = ../..
WXINC = $(WXDIR)/include
WXLIB=$(WXDIR)/lib/libwx$(GUISUFFIX).a
OBJDIR=objects$(GUISUFFIX)

SOURCES = hello.cc
HEADERS = hello.h
OBJECTS = $(OBJDIR)/hello.o

# Default is to use XView
DEBUG = -ggdb
WARN = -Wall
OPT =
GUI = -Dwx_xview
XVIEW_LINK = $(WXDIR)/src/x/objects_ol/sb_scrol.o

INC = -I$(WXINC) -I$(WXDIR)/include/base -I$(WXDIR)/include/x

CPPFLAGS = $(XINCLUDE) $(INC) $(GUI) $(DEBUG) $(WARN) $(OPT)
LDFLAGS = $(XLIB) -L$(WXDIR)/lib
# For SGI, include -lPW on your LDLIBS
LDLIBS = -lwx_ol -lxview -lolgx -lX11 -lm -lg++

.SUFFIXES:

all:	$(OBJDIR) hello$(GUISUFFIX)

wxmotif:
	cd $(WXDIR)/src/x; make -f makefile.unx motif

wxxview:
	cd $(WXDIR)/src/x; make -f makefile.unx xview

# For SGI, include -lPW on your LDLIBS
motif:
	cd $(WXDIR)/src/x; make -f makefile.unx motif OPT='$(OPT)'
	make -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='-lwx_motif -lXm -lXt -lX11 -lm -lg++' WXLIB=$(WXDIR)/lib/libwx_motif.a XVIEW_LINK=

xview:
	cd $(WXDIR)/src/x; make -f makefile.unx xview OPT='$(OPT)'
	make -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol OPT='$(OPT)'

hp:
	cd $(WXDIR)/src/x; make -f makefile.unx hp
	make -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC OPT='' DEBUG='-g' WARN='-w' \
           XINCLUDE='-I/usr/include/Motif1.2 -I/usr/include/X11R5' \
           XLIB='-L/usr/lib/Motif1.2 -L/usr/lib/X11R5' \
           XVIEW_LINK='' \
           LDLIBS='-lwx_hp -lXm -lXt -lX11 -lm'

$(OBJDIR):
	mkdir $(OBJDIR)

hello$(GUISUFFIX): $(OBJDIR)/hello.o $(WXLIB)
	$(CC) $(CPPFLAGS) $(LDFLAGS) -o hello$(GUISUFFIX) $(OBJDIR)/hello.o $(XVIEW_LINK) $(LDLIBS)

$(OBJDIR)/hello.o:        hello.cc hello.h
	$(CC) -c $(CPPFLAGS) -o $@ hello.cc

clean_motif:
	make -f makefile.unx GUISUFFIX=_motif cleanany

clean_ol:
	make -f makefile.unx GUISUFFIX=_ol cleanany

clean_hp:
	make -f makefile.unx GUISUFFIX=_hp cleanany

cleanany:
	rm -f $(OBJECTS) hello$(GUISUFFIX) core

wxclean_ol:
	cd $(WXDIR)/src/x; make -f makefile.unx clean_ol

wxclean_motif:
	cd $(WXDIR)/src/x; make -f makefile.unx clean_motif

wxclean_hp:
	cd $(WXDIR)/src/x; make -f makefile.unx clean_hp

