#
#  makefile for widgets support library
#

# Name of this library
# (base) Name of ar and lint library for this library
LIBID = xwa
ARLIB = $(LIBID)
LINTLIB = $(LIBID)
#DBUG = -g

# Include flags
INCFLAGS = -I$(IDIR) -I.

# Lint flags and libs
LINTLIBS = $(LINTLIBLOC)
LINTFLAGS = $(INCFLAGS) $(DBUG) -D$(SYS)

# Version number of the library
VERSION = 1

# Choice of compiler
#CC = gcc
CC = cc

#CFLAGS = -O -traditional $(INCFLAGS)
CFLAGS = $(SYSCFLAGS) $(INCFLAGS) $(DBUG) -D$(SYS)

SRCS	= Command.c \
	  Label.c \
	  Toggle.c \
	  Viewport.c \
	  KindBox.c \
	  Signal.c \
	  Signalmgr.c

INSTHFILES = Command.h \
	  Label.h \
	  Toggle.h \
	  Viewport.h \
	  KindBox.h \
	  XtArgs.h \
	  Signal.h \
	  Signalmgr.h

HDRS = $(INSTHFILES) \
	LabelP.h \
	CommandI.h \
	CommandP.h \
	ToggleP.h \
	ViewportP.h \
	SignalP.h

OBJS	= Command.o \
	  Label.o \
	  Toggle.o \
	  Viewport.o \
	  KindBox.o \
	  Signal.o \
	  Signalmgr.o

LIBSRCS = $(SRCS)
LIBOBJS = $(OBJS)

DOC	=

MAKEFILE = Makefile

JUNK = tmp core makelog skeleton.log skeleton.aux skeleton.dvi \
       $(ARLIBNAME) $(LINTLIBNAME) lint

DISTFILES = $(LIBSRCS) $(HDRS) $(DOC) $(MAKEFILE)

LINTLIBSRCS = $(LIBSRCS)
AROBJS = $(LIBOBJS)

#++ make module lintlib start, do NOT touch this line. ++
### lintlib ###
# LINTLIBSRCS	- list of source files for this lint lib
# LINTFLAGS	- additional lint flags
# LINTLIB	- base name of lint library to create
LINTLIBNAME = llib-l$(LINTLIB).ln
$(LINTLIBNAME): $(LINTLIBSRCS)
	lint -o $(LINTLIB) $(SYSLINTFLAGS) $(LINTFLAGS) $(LINTLIBSRCS)
#++ make module lintlib end, do NOT touch this line. ++

#++ make module arlib start, do NOT touch this line. ++
### arlib ###
# AROBJS	- list of source files for ar
# ADDITIONALarFLAGS	- additional ar flags
# ARLIB		- base name of ar library to create
ARFLAGS   = rv
ARLIBNAME = lib$(ARLIB).a
$(ARLIBNAME): $(AROBJS)
	ar $(ARFLAGS) $(ARLIBNAME) $(ADDITIONALarFLAGS) $(AROBJS)
#ranlib $(ARLIBNAME)
#++ make module arlib end, do NOT touch this line. ++

#++ make module local start, do NOT touch this line. ++
# Installation dependent make variables for ericv on HERMES 

# full path of the ESPRIT environment
ESPRITDIR = /home1/forfun

#  BDIR     : bin directory
BDIR = $(ESPRITDIR)/binA

#  IDIR     : include directory
IDIR = $(ESPRITDIR)/include

#  LDIR     : library directory
LDIR = $(ESPRITDIR)/libA


NFULLDS = $(ESPRITDIR)/ds/nfullgl.ds
NKERNDS = $(ESPRITDIR)/ds/nkerngl.ds

#  HOSTNAME : name of installation machine.
HOSTNAME=hermes

# SYS     : name of operating system or machine type
#     BSD	For generic BSD systems
#     AVIION	For generic DG_UX systems
#     HPUX	For all HP-UX systems
#     SUN	For all SUN systems
#     APOLLO	For all Apollo systems
SYS = AVIION

# CLIBLOC : required C libraries
CLIBLOC =

LINTLIBLOC =

PASLIBLOC =

# CBADADR : address that will cause a core-dump if read or written.
CBADADR = 0

SYSLINTFLAGS = -hpac
SYSCFLAGS = 
SYSCPROFFLAGS =
SYSCDBUGFLAGS =
SYSPFLAGS =
OFLAG= -O
# Collection of host dependent make rules.

### libinstall ###
# MODULE	- module to install
libinstall:
	cp $(MODULE) $(LDIR)/$(MODULE)

### includeinstall ###
# MODULE	- module to install
includeinstall:
	cp $(MODULE) $(IDIR)/$(MODULE)

### maninstall ###
# MAN		- manual page to install
maninstall:
	cp $(MAN) /usr/man/manl

### bininstall ###
# MODULE	- module to install
bininstall:
	cp $(MODULE) $(BDIR)/$(MODULE)
	strip $(BDIR)/$(MODULE)

### arlibinstall ###
# MODULE	- module to install
arlibinstall:
	cp $(MODULE) $(LDIR)/$(MODULE)

LINK.c=$(CC) 
#++ make module local end, do NOT touch this line. ++

help :
	@echo " Possible make targets:"
	@echo "all		Create local running programs."
	@echo "clean		Free disk space."
	@echo "distfiles	List distribution files."
	@echo "install		Install relevant files."
	@echo "instlib		Install only updated library."
	@echo "lint		Lint the files."
	@echo "setup            Adapt sources to local situation."
	@echo "test		Run tests."

all: lib$(LIBID).a

# Add rules for the programs themselves here.
test :
	@echo "Sorry, no testing for skeleton"

install: $(ARLIBNAME)
	make 'MODULE=$(ARLIBNAME)' arlibinstall
	make 'MODULE=Command.h' includeinstall
	make 'MODULE=Label.h' includeinstall
	make 'MODULE=Toggle.h' includeinstall
	make 'MODULE=Viewport.h' includeinstall
	make 'MODULE=KindBox.h' includeinstall
	make 'MODULE=XtArgs.h' includeinstall
	make 'MODULE=Signal.h' includeinstall
	make 'MODULE=Signalmgr.h' includeinstall

lint: $(LINTLIBNAME)

instlint: $(LINTLIBNAME)
	make 'MODULE=$(LINTLIBNAME)' libinstall

instlib: $(ARLIBNAME)
	make 'MODULE=$(ARLIBNAME)' arlibinstall

clean:
	rm -f $(JUNK) $(OBJS)

distfiles:
	@echo $(DISTFILES) | tr ' ' '\012'

setup:
	modmake local ../make.local $(MAKEFILE)
	modmake arlib ../make.arlib $(MAKEFILE)
	modmake lintlib ../make.lintlib $(MAKEFILE)

# Non-standard make rules
###
depend:
	mkmf -f $(MAKEFILE)

Command.o:   Command.h CommandI.h CommandP.h
Label.o:     Label.h LabelP.h
Signal.o:    Signal.h SignalP.h
Signalmgr.o: Signalmgr.h SignalmgrP.h
Toggle.o:    Toggle.h ToggleP.h
Viewport.o:  Viewport.h ViewportP.h
KindBox.o:   KindBox.h
