#
# File:		makefile.unx
# Author:	Julian Smart
# Created:	1993
# Updated:	
# Copyright:	(c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile for server/client 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$(WXINC) -I$(WXDIR)/include/base -I$(WXDIR)/include/x
OBJDIR = objects$(GUISUFFIX)

OBJECTS=$(OBJDIR)/server.o $(OBJDIR)/client.o

OPT = -O
DEBUG = -ggdb
WARN=-Wall
GUI = -Dwx_xview
XVIEW_LINK = $(WXDIR)/src/x/objects_ol/sb_scrol.o

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

all:	$(OBJDIR) server$(GUISUFFIX) client$(GUISUFFIX)

.SUFFIXES:

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

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

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)'
	make -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol 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)

# .cc.o:	
#	$(CC) -c $(CPPFLAGS) -o $@ $*.cc

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

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

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

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