#               LIBRARY MAKEFILE

# Module name
LIBNAME = libx
LIBFILES  = smart_xmain.o smart_xsec.o smart_xmain_ui.o smart_xsec_ui.o 

#smart_xsec_stubs.o smart_xmain_stubs.o

# This file was generated by `gxv' from `smart_xmain.G'.

# Parameters.

PROGRAM = smartx
SOURCES.c = smart_xmain.c smart_xsec.c
SOURCES.h = xfunctions.h
SOURCES.G = smart_xmain.G smart_xsec.G
STUBS.G = 


# Flags normally set in top level makefile.  Make sure you want these
# default if you compile locally in this directory
PREFIX = /home/ux5/ux5c/icsd/lit/smart/src.new
BIN = $(PREFIX)/bin
LIB = $(PREFIX)/lib
H   = ../h

# Version numbers
MAJOR = 10
MINOR = 1

# Sun static libraries
CC     = cc
CFLAGS = -g -L$(LIB) -I../$H $(CPPFLAGS) $(LDFLAGS) $(LDLIBS) -Bstatic 

# Static libraries with gcc and optimization
#CC       = gcc
#OPTFLAGS = -O -fstrength-reduce -fcombine-regs -finline-functions \
#            -fdelayed-branch
#CFLAGS   = -I$H -L$(LIB) -g -traditional -Wall $(OPTFLAGS)

# Static libraries with gcc
#CC       = gcc
#CFLAGS   = -I$H -L$(LIB) -g -traditional -Wall

# Other macros used in some or all makefiles
PRINT  = print
AR     = -ar
ARFLAGS= urv
RANLIB = ranlib

# Derived parameters.

SOURCES = \
	$(SOURCES.G) \
	$(SOURCES.h) \
	$(SOURCES.l) \
	$(SOURCES.y) \
	$(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)

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

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

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

# Compiler flags.

CPPFLAGS += -I$(GUIDEHOME)/include -I$(OPENWINHOME)/include
LDFLAGS += -L$(GUIDEHOME)/lib -L$(OPENWINHOME)/lib
LDLIBS += -lguide -lguidexv -lxview -lolgx -lX

# 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) $(CPPFALGS)
	$(LINK.c) -o $(PROGRAM) $(OBJECTS) $(LDLIBS)

# Targets to be used by a certain CASE tool.

stest: $(SOURCES.c) $(TARGETS.c) $(TARGETS.h) $(OBJECTS)
	#load $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) \
		-o $(PROGRAM) $(SOURCES.c) $(TARGETS.c) $(LDLIBS)

#%_ui.c + %_ui.h + %_stubs.c + %.info: %.G
#	$(GUIDEHOME)/bin/gxv $*

#############################################################################
#  All code below this line (except for automatically created dependencies)
#  is independent of this particular makefile, and should not be changed!
#############################################################################

# Entry points install and all are the same.  If you want to "make install"
# a non-test version in this directory alone, YOU MUST SPECIFY "PREFIX=..." ON
# THE COMMAND LINE  where ".../lib" gives the location you wish the
# library placed.  By default it will end up in the test directory.

install all:  $(LIB)/$(LIBNAME).a

#########################################################################
# Compilation of Libraries                                              #
# Note that a copy of the library is NOT kept in the current directory. #
#########################################################################
$(LIB)/$(LIBNAME).a : $(LIB)/$(LIBNAME).a($(LIBFILES))
	$(RANLIB) $(LIB)/$(LIBNAME).a

#########################################################################
# Saving program versions                                               #
#########################################################################
rcs:
	-ci -q "-mAutomatic checkin" *.c

#########################################################################
# Odds and ends                                                         #
#########################################################################
clean:
	/bin/rm -f *.o *.BAK *~ $(LIBNAME).a $(LIBNAME).so $(LIB)/$(LIBNAME).a

print: # $(FILES) makefile
	$(PRINT) $?
	cat >print </dev/null

# This version of lint is no longer useful, since most routines never
# explicitly called by others
lint:
	$(LINT) -I$H -C$(LIBNAME) *.c
	mv llib-l$(LIBNAME).ln $(LIB)


#########################################################################
# Determining program dependencies                                      #
#########################################################################
depend:
	grep '^#[ ]*include' *.c \
		| sed -e 's?:[^"]*"\([^"]*\)".*?: \$H/\1?' \
		-e '/</d' \
	        -e 's/\.c/.o/' \
	        -e 's/\.y/.o/' \
	        -e 's/\.l/.o/' \
                -e 's?\(.*\)\.o?\$$(LIB)/\$$(LIBNAME)\.a(\1.o)?' \
	> makedep

	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp makefile makefile.bak
	ed - makefile < eddep
	/bin/rm eddep makedep
	echo '# DEPENDENCIES MUST END AT END OF FILE' >> makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> makefile
	echo '# see make depend above' >> makefile

# DO NOT DELETE THIS LINE -- make depend uses it

# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above

