# SKIP Source Code License Statement:
# ------------------------------------------------------------------
#   Copyright
#   Sun Microsystems, Inc.
# 
# 
#   Copyright (C) 1994, 1995, 1996 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 `skiptool.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=$(OPENWINHOME)

# Parameters.

PROGRAM = $(U_DIR)/skiptool
ES_STAT = $(U_DIR)/skipstat_ui
SOURCES.c = es_glue.c es_ras.c es_interactive.c es_timers.c es_systems.c
SOURCES.h = es_glue.h es_ras.h es_timers.h es_stats.h es_timers.h es_systems.h \
			es_interactive.h skiptool_ui.h
RASTERS	= none.ras skiptool_small.ras icon_v1.ras icon_v2.ras unknown.ras \
			updated.ras nomadic.ras
SOURCES_X = none.xbm icon_v1.xbm icon_v2.xbm skiptool_small.xbm \
			unknown.xbm updated.xbm nomadic.xbm

SOURCES.G = skiptool.G
STUBS.G = skiptool.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)

# Compiler flags.

DYNAMIC_PATH	= $(DYNAMIC_$(OSNAME))
CFLAGS 		+= $(U_DEBUG) $(OS) -DSKIP_RELEASE="\"$(SKIP_RELEASE)\""
SKIPINC_DIR 	=  -I../lib -I$(COMM_INC) -I$(DRVDIR)
CPPFLAGS 	+= -I$(WIN_HOME)/include -DMAIN $(SKIPINC_DIR)
CPPFLAGS 	+= -I$(WIN_HOME)/include/pixrect
LDFLAGS 	+= -L$(WIN_HOME)/lib $(DYNAMIC_PATH)
LDLIBS 		+= ../lib/$(SKIP_LIB) $(OS_LIB) -lxview -lolgx -lX11

$(U_DIR)/%.o: %.c  \
	../lib/skip_lib.h ../lib/skip_msgs.h ../../include/skip_ioctl.h \
	../../include/skip_conf.h $(SYSINC) $(SOURCES.h)
	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $(U_DIR)/$*.o $<



# Standard targets.

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

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

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

$(ES_STAT): $(U_DIR)/es_stats.o $(U_DIR)/es_ras.o $(RASTERS)
	$(LINK.c) -o $@ $(U_DIR)/es_stats.o $(U_DIR)/es_ras.o $(LDLIBS)

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

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

gxv:
	gxv -s skiptool

#%_ui.c: %.G
#	$(GUIDE)/bin/gxv -s $(PROGRAM) 

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

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

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