# SKIP Source Code License Statement:
# ------------------------------------------------------------------
#   Copyright
#   Sun Microsystems, Inc.
# 
# 
#   Copyright (C) 1994, 1995 Sun Microsystems, Inc.  All Rights
#   Reserved.
# 
#   Permission is hereby granted, free of charge, to any person
#   obtaining a copy of this software and associated documentation
#   files (the "Software"), to deal in the Software without
#   restriction, including without limitation the rights to use,
#   copy, modify, merge, publish, distribute, sublicense, and/or sell
#   copies of the Software or derivatives of the Software, and to 
#   permit persons to whom the Software or its derivatives is furnished 
#   to do so, subject to the following conditions:
# 
#   The above copyright notice and this permission notice shall be
#   included in all copies or substantial portions of the Software.
# 
#   The Software must not be transferred to persons who are not US
#   citizens or permanent residents of the US or exported outside
#   the US (except Canada) in any form (including by electronic
#   transmission) without prior written approval from the US
#   Government. Non-compliance with these restrictions constitutes
#   a violation of the U.S. Export Control Laws.
# 
#   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
#   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
#   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
#   NONINFRINGEMENT.  IN NO EVENT SHALL SUN MICROSYSTEMS, INC., BE LIABLE
#   FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
#   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
#   CONNECTION WITH THE SOFTWARE OR DERIVATES OF THIS SOFTWARE OR 
#   THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# 
#   Except as contained in this notice, the name of Sun Microsystems, Inc.
#   shall not be used in advertising or otherwise to promote
#   the sale, use or other dealings in this Software or its derivatives 
#   without prior written authorization from Sun Microsystems, Inc.
include ../../../Makefile.defs

# This file was generated by `gxv' from `ks.G'.
# If OPENWINHOME is set, then use that location to
# search for the include files and library files. If
# it is not set, then use /usr/openwin.
WIN_HOME:sh = \
 (					\
  case ${OPENWINHOME}			\
  in ?*) echo ${OPENWINHOME};;		\
      *) echo "/usr/openwin";;		\
  esac;					\
 )

GUIDE:sh = \
 (                                      \
  case ${GUIDEHOME}                     \
  in ?*) echo ${GUIDEHOME};;            \
      *) echo "/usr/dist/local/share/devguide,v3.0.1/5.x-sparc";; \
  esac;                                 \
 )

# Parameters.

PROGRAM = $(U_DIR)/keystat
SOURCES.c = ks_glue.c ks_ras.c
SOURCES.h = 
SOURCES.G = ks.G
STUBS.G = ks.G

# Derived parameters.

SOURCES = \
	$(SOURCES.G) \
	$(SOURCES.h) \
	$(SOURCES.l) \
	$(SOURCES.y) \
	$(SOURCES.cps) \
	$(SOURCES.c)

TARGETS.c = \
	$(SOURCES.G:%.G=%_ui.c) \
	$(STUBS.G:%.G=%_stubs.c)

TARGETS.h = \
	$(SOURCES.G:%.G=%_ui.h) \
	$(SOURCES.l:%.l=%.h) \
	$(SOURCES.y:%.y=%.h) \
	$(SOURCES.cps:%.cps=%.h)

TARGETS.other = \
	$(SOURCES.G:%.G=%.info)

TARGETS = \
	$(TARGETS.other) \
	$(TARGETS.h) \
	$(TARGETS.c)

OBJECTS = \
	$(SOURCES.c:%.c=$(U_DIR)/%.o) \
	$(TARGETS.c:%.c=$(U_DIR)/%.o)

RASTERS = 0.ras  1.ras 2.ras 3.ras 4.ras 5.ras 6.ras 7.ras \
	0_bw.ras 1_bw.ras 2_bw.ras 3_bw.ras 4_bw.ras 5_bw.ras 6_bw.ras 7_bw.ras

# Compiler flags.
CFLAGS		+=  $(U_DEBUG)
CPPFLAGS	+= -I../lib -I../../include  -I$(GUIDE)/include \
			-I$(WIN_HOME)/include  -DMAIN  -D$(ARCH)

DYNAMIC_PATHOS5	= -R$(WIN_HOME)/lib
DYNAMIC_PATH	= $(DYNAMIC_PATHOS$(MAJOR_OS))
LDFLAGS		+=  -L$(WIN_HOME)/lib $(DYNAMIC_PATH)
LDLIBS		+= ../lib/$(SKIP_LIB) $(OS_LIB)  -lxview -lolgx -lX11  

HDRS	=  ks_glue.h ks_ras.h ks_ui.h key.icon ../lib/skip_lib.h \
		../../include/skip_ioctl.h ../../include/skip_conf.h

$(U_DIR)/%.o: %.c $(HDRS)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $(U_DIR)/$*.o $<

.INIT:
	@[ -d $(U_DIR) ] || mkdir -p $(U_DIR)

# Standard targets.

all:	 $(TARGETS.other) $(PROGRAM)
objects: $(SOURCES.c) $(TARGETS.c) $(TARGETS.h) $(OBJECTS)
sources: $(SOURCES)
targets: $(SOURCES) $(TARGETS)

$(PROGRAM): $(SOURCES.c) $(TARGETS.c) $(TARGETS.h) $(OBJECTS) $(RASTERS) \
		../lib/$(SKIP_LIB)
	$(LINK.c) -o $@ $(OBJECTS) $(LDLIBS)

clean:
	@$(RM) -rf $(U_DIR)
	@$(RM)  *.BAK *.delta core
	@-$(SCCSCLEAN)

cleanall:
	@$(RM) -rf *bin.*
	@$(RM)  *.BAK *.delta core
	@-$(SCCSCLEAN)

gxv: ks.G
	$(GUIDE)/bin/gxv -s ks.G

#%_ui.h: %_ui.c
#	@touch $@

#%_stubs.c: %_ui.c
#	@touch $@

#%.info: %_ui.c
#	@touch $@
