#
# File:		makefile.unx
# Author:	Julian Smart
# Created:	1993
# Updated:	
# Copyright:	(c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile for mdi example (UNIX).

GUISUFFIX=_ol
CC = gcc-2.1

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

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

INC = -I$(WXDIR)/include/base -I$(WXDIR)/include/x
OBJDIR = objects$(GUISUFFIX)

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

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

CPPFLAGS = $(XINCLUDE) $(INC) -I$(WXDIR)/dummy $(GUI) $(DEBUG) $(WARN) $(OPT)
LDFLAGS = $(XLIB) -L$(WXDIR)/lib
LDLIBS = -lwx_ol -lxview -lolgx -lX11 -lm -lg++

.SUFFIXES:

all:    $(OBJDIR) mdi$(GUISUFFIX)

wx:
#	cd $(WXDIR)/src/x; make -f makefile.unx
motif:
	cd $(WXDIR)/src/x; make -f makefile.unx motif OPT='$(OPT)'
	make -f makefile.unx GUI=-Dwx_motif OPT='$(OPT)' GUISUFFIX=_motif LDLIBS='-lwx_motif -lXm -lXt -lX11 -lm -lg++' XVIEW_LINK=

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

hp:
	make -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='' 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)

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

$(OBJDIR)/mdi.o:        mdi.cc mdi.h
	$(CC) -c $(CPPFLAGS) -o $@ mdi.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) mdi$(GUISUFFIX) core
