#!smake
#
# Makefile for McMousepanel & McMouse
#
# This makefile follows various conventions used by SGI makefiles
#
include $(ROOT)/usr/include/make/commondefs
#
# Local Definitions
#
INSTALL = /etc/install
INSTALLFLAGS = -m 755 -O -v
INSTALLDATAFLAGs = -m 644 -v
INSTHELPDIR = /usr/share/help
HELPDIR = help
HELPMAPFILE = *.helpmap
IMAGESDIR = help/images
INSTDATADIR = /usr/demos/IndiZone/.data/Lumbus
INSTBINDIR = /usr/demos/IndiZone

# Directory in which inst images are placed

IMAGEDIR= images


#  The GL library being used, if needed

GLLIBS= -lgl
COMPONENTLIBS= 


#
# The ViewKit stub help library (-lvkhelp) provides a simple 
# implementation of the SGI help API. Changing this to -ldesktopUtil
# switches to the full IRIS Insight help system
#

HELPLIB= -ldesktopUtil

# Standard ViewKit header and libraries

VIEWKITFLAGS= -I$(ROOT)/usr/include/Vk
TOOLTALKLIBS=
NETLS=

EZLIB = -lvkEZ
VIEWKITLIBS= $(TOOLTALKLIBS) $(EZLIB) -lvk $(HELPLIB) $(NETLS) -lSgm -lXpm

# Local C++ options.
# woff 3262 shuts off warnings about arguments that are declared
# but not referenced.

WOFF= -woff 3262

LCXXOPTS = -nostdinc -I$(ROOT)/usr/include $(SAFLAG) $(WOFF) $(VIEWKITFLAGS) 

# Add Additional libraries to USERLIBS:

USERLIBS= -lvl -lm

LLDLIBS =  -L$(ROOT)/usr/lib $(USERLIBS) $(COMPONENTLIBS) $(VIEWKITLIBS) $(GLLIBS) -lXm -lXt -lX11 -lgen 

# While developing, leave OPTIMIZER set to -g.
# For delivery, change to -O2

OPTIMIZER= -O2

# SGI makefiles don't recognize all C++ sufixes, so set up
# the one being used here.

CXXO3=$(CXXO2:.c++=.o)
CXXOALL=$(CXXO3)

#
# Source Files generated by the builder. If files are added
# manually, add them to USERFILES
#

BUILDERFILES =  main.c++\
		McMouseSettings.c++\
		McMouseSettingsUI.c++\
		VkwindowMainWindow.c++\
		unimplemented.c++\
		$(NULL)

#
# Add any files added outside the builder here
#

USERFILES =



#
# The program being built
#

TARGETS=McMousepanel McMouse
APPDEFAULTS=McMpanel
default : install

#McMousepanel: $(OBJECTS)
#	$(C++) $(OPTIMIZER)  $(OBJECTS) $(LDFLAGS) -o $@
#McMouse: McMouse.o McMouseStruct.h
#	$(CC) $(OPTIMIZER) McMouse.o $(LDFLAGS) -o $@

#
# The VkUnimplemented function used for Fix+Continue support
#

unimplemented.o: unimplemented.c++
	$(C++) -c -O unimplemented.c++
#
# These flags instruct the compiler to output
# analysis information for cvstatic
# Uncoment to enable
# Be sure to also disable smake if cvstatic is used

#SADIR= McM.cvdb
#SAFLAG= -sa,$(SADIR)
#$(OBJECTS):$(SADIR)/cvdb.dbd
#$(SADIR)/cvdb.dbd :
#	[ -d $(SADIR) ] || mkdir $(SADIR)
#	cd $(SADIR); initcvdb.sh

#LDIRT=$(SADIR) vista.taf
# The dirt left by this make procedure
LDIRT = $(IMAGESDIR) $(HELPDIR)/*IDB* $(HELPDIR)/book* $(HELPDIR)/*idb* Makedepend McMousepanel McMouse


#
# To install on the local machine, do 'make install'
#

install: 
	$(INSTALL) -F /usr/lib/X11/app-defaults McMpanel
	$(INSTALL) -F /usr/sbin McMousepanel
	$(INSTALL) -F /usr/sbin McMouse
	$(INSTALL) $(INSTALLFLAGS) -F $(INSTBINDIR) $(TARGETS)
	mv $(INSTBINDIR)/McMouse $(INSTBINDIR)/.McMouse
	mv $(INSTBINDIR)/McMousepanel $(INSTBINDIR)/.McMousepanel
	(cd $(HELPDIR); $(INSTALL) $(INSTALLDATAFLAGS) -F $(INSTHELPDIR) $(HELPMAPFILE))
#	(cd $(HELPDIR); make images)
	(cd $(IMAGESDIR); inst -af . -u upgrade_and_new)
#
# as per request of IndiZone Guidelines we remove all temporary file
# after the installation. This is not something I would normaly
# do automaticaly.
#	(make clean)    


#
# To create inst images, do 'make image'
# An image subdirectory should already exist
#

$(IMAGEDIR):
	@mkdir $(IMAGEDIR)
image: $(TARGETS) $(IMAGEDIR)
	/usr/sbin/gendist -rbase / -sbase / -idb McMousepanel.idb \
         -spec McMousepanel.spec \
        -dist /usr/people/hoesel/game/sp/McM/images  -all

include $(COMMONRULES)
