#
# @(#)Makefile.fcs 3.4 94/05/25 SMI
#
# Makefile for demo/examples directory
#
# Makefile to build XGL 3.0.2 example programs.
#
# If OpenWindows and XGL are not in their default
# locations, then the environment variables OPENWINHOME
# and XGLHOME must be set before using this Makefile.
# Default locations:
#
#   OpenWindows - /usr/openwin
#   XGL 3.0.2   - /opt/SUNWits/Graphics-sw/xgl-3.0
#

.KEEP_STATE:

# to get OS major version number...for differences
# between 4.x and SVr4
OSVER:sh=/usr/bin/uname -r | /usr/bin/cut -f1 -d.

# to set up a default for XGLHOME
XGLHOMELIB:sh=echo ${XGLHOME-/opt/SUNWits/Graphics-sw/xgl-3.0}
# to set up a default for OPENWINHOME
OPENWINHOMELIB:sh=echo ${OPENWINHOME-/usr/openwin}

CFLAGS = -g

INCFLAGS = -I$(OPENWINHOMELIB)/include -I$(XGLHOMELIB)/include
CPPFLAGS_5 = -D__SVR4__ $(INCFLAGS)
CPPFLAGS = $(CPPFLAGS_$(OSVER))

XGL_LIB  = -lxgl
SYS_LIBS = -lXol -lXt -lxview -lolgx -lX11 -ldga -ldl

OS_LIBS_5 = -lintl -lnsl -lsocket
OS_LIBS = $(OS_LIBS_$(OSVER))

LIBS = -L$(OPENWINHOMELIB)/lib -L$(XGLHOMELIB)/lib \
        $(XGL_LIB) $(SYS_LIBS) $(OS_LIBS) -lm

# Example program
#
PROGS   = ow_olit

$(PROGS): $$@.o
	$(LINK.c) $@.o $(LIBS) \
	-R /opt/SUNWits/Graphics-sw/xgl-3.0/lib:/usr/openwin/lib \
	-o $@

#
# Generic targets
#
all:	$(PROGS)

clean:
	rm *.o $(PROGS)

default:
	@echo "XGL example programs"
	@echo "make one of:"
	@echo "	$(PROGS) "
	@echo "or all"

echo_all:
	@echo $(PROGS)

