# Makefile
#
# Makefile for tooltips system.
#
# Copyright (C) 1996  Michael Chu
# This file is part of the tooltips system for XForms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Contact information:      Michael Chu
#                           mmchu@CS.Berkeley.EDU

# Version number.
VERSION = 0.02f

# Define where the XForms include files are.
XFORMS_INCLUDE_DIR = ../../xforms/FORMS

# Define where the X11 include files are.
X11_INCLUDE_DIR = /usr/include/X11

# Define other include file directories.
OTHER_INCLUDE_DIR = /usr/include

# Uncomment out this line if you do not want debug information included.
# DEBUG = -g -Wall -ansi -pedantic
DEBUG = 

# Define the utilities to use for compilation.
CC         = gcc
CCOPTS     = $(DEBUG) -I$(XFORMS_INCLUDE_DIR) -I$(X11_INCLUDE_DIR) \
             -I$(OTHER_INCLUDE_DIR)
AR         = ar
AROPTS     = rc
RM         = rm
RMOPTS     = -rf
ECHO       = echo
ECHOOPTS   =
TAR        = tar
TAROPTS    = 
GZIP       = gzip
GZIPOPTS   = -9
MKDIR      = mkdir
MKDIROPTS  =
CP         = cp
CPOPTS     =
CHMOD      = chmod
CHMODOPTS  = -R +rw
CD         = cd
CDOPTS     =
RANLIB     = ranlib
RANLIBOPTS = 
LN         = ln
LNOPTS     = -s

###########################################################################
all: libtooltips.a

libtooltips.a: tooltips.o tooltips_forms.o
	@$(ECHO) $(ECHOOPTS) Removing old library if it exists...
	@$(RM) $(RMOPTS) libtooltips.a
	@$(ECHO) $(ECHOOPTS) Creating new library from object files...
	@$(AR) $(AROPTS) libtooltips.a tooltips.o tooltips_forms.o
	@$(RANLIB) $(RANLIBOPTS) libtooltips.a

tooltips.o: tooltips.c tooltips.h tooltips_forms.h
	@$(ECHO) $(ECHOOPTS) Compiling tooltips.o from tooltips.c...
	@$(CC) $(CCOPTS) -c tooltips.c

tooltips_forms.o: tooltips_forms.c tooltips_forms.h
	@$(ECHO) $(ECHOOPTS) Compiling tooltips_forms.o from tooltips_forms.c...
	@$(CC) $(CCOPTS) -c tooltips_forms.c

clean:
	@$(ECHO) $(ECHOOPTS) Removing all old object files and libraries...
	@$(RM) $(RMOPTS) *~ *.o *.a

dist: Makefile COPYING tooltips.c tooltips.h tooltips_forms.c
dist: tooltips_forms.h tooltips_forms.fd
	@$(ECHO) $(ECHOOPTS) Removing previous distribution/work files...
	@$(RM) $(RMOPTS) tooltips-$(VERSION).tar tooltips-$(VERSION).tar.gz
	@$(RM) $(RMOPTS) tooltips-$(VERSION)
	@$(ECHO) $(ECHOOPTS) Creating distribution file...
	@$(MKDIR) $(MKDIROPTS) tooltips-$(VERSION)
	@$(CP) $(CPOPTS) Makefile CHANGES COPYING README THANKS TODO \
	   tooltips.c tooltips.h \
	   tooltips_forms.c tooltips_forms.h tooltips_forms.fd \
	   tooltips-$(VERSION)
	@$(MKDIR) $(MKDIROPTS) tooltips-$(VERSION)/examples
	@$(MKDIR) $(MKDIROPTS) tooltips-$(VERSION)/examples/menu
	@$(CP) $(CPOPTS) examples/menu/Makefile examples/menu/menu.c \
	   examples/menu/menu_forms.c examples/menu/menu_forms.fd \
	   examples/menu/menu_forms.h \
	   tooltips-$(VERSION)/examples/menu
	@$(CHMOD) $(CHMODOPTS) tooltips-$(VERSION)
	@$(LN) $(LNOPTS) tooltips-$(VERSION) tooltips
	@$(TAR) $(TAROPTS) cf tooltips-$(VERSION).tar tooltips-$(VERSION) \
	   tooltips
	@$(ECHO) $(ECHOOPTS) Compressing distribution file...
	@$(GZIP) $(GZIPOPTS) tooltips-$(VERSION).tar
	@$(ECHO) $(ECHOOPTS) Removing work files...
	@$(RM) $(RMOPTS) tooltips-$(VERSION) tooltips \
	   tooltips-$(VERSION)-work.tar

