# Makefile for /usr/miro/src/lib/structures

#
#/*****************************************************************************
#                Copyright Carnegie Mellon University 1992
#
#                      All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of CMU not be
# used in advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
#
# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
# CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
#*****************************************************************************/
#

include $(TOPLEVEL)/Makefile.include

LIB_NAME =	structures
OUTPUT_LIB =	$(OBJECT_DIR)/$(LIB_NAME).a
LINT_LIB =	$(OBJECT_DIR)/llib-l$(LIB_NAME).ln
SOURCE =	arrow.c box.c box-relations.c sysname-hash.c
OBJ =		$(SOURCE:.c=.o)
OBJECTS =	$(OBJ;.*;$(OBJECT_DIR)/&)
GLOBALS =	arrow.g box-relations.g box.g
HEADERS = 	$(SOURCE:.c=.h)

MYPROGRAMS =	$(OUTPUT_LIB)

# Lint Flags
# LINT_FLAGS = -abchx
LINT_FLAGS = -abh

# Use the following def for debugging:
# CFLAGS = -g -I$(INCLUDE_DIR)/

# Use the following defs for profiling execution:
CFLAGS = -g -p -I$(INCLUDE_DIR)/
LDFLAGS = -p -L$(TOPLEVEL)/../lib/

# Use the following defs for optimization:
# CFLAGS = -O -I$(INCLUDE_DIR)/
# LDFLAGS = -s

all: $(MYPROGRAMS)

$(OUTPUT_LIB): $(OBJECTS)
	ar ruc $(OUTPUT_LIB) $>
	ranlib $(OUTPUT_LIB)

$(LINT_LIB): $(SOURCE) $(HEADERS) $(GLOBALS)
	cd $(OBJECT_DIR) ; lint -C$(LIB_NAME) $(SOURCE;.*;$(OBJ_SOURCE_DIR)/&)

# override the 'foo.c -> foo' rule so it does nothing
.c:

lint:
	lint $(LINT_FLAGS) $(SOURCE)

wc:
	wc $(HEADERS) $(SOURCE)

clean:
	rm -f $(OBJECTS)


# Header File Dependencies
include $(TOPLEVEL)/../libi/make/parse-headers
include $(TOPLEVEL)/../libi/make/structures-headers

# Object files depending on header files
$(OBJECT_DIR)/arrow.o		: $(ERROR_H) $(ID_HASH_H) $(MEM_H) \
				  $(PARSER_H) $(BOX_H) $(ARROW_H) \
				  $(SYSNAME_HASH_H) arrow.c
	$(CC) $(CFLAGS) -c -o $(OBJECT_DIR)/arrow.o arrow.c

$(OBJECT_DIR)/box.o		: $(ERROR_H) $(MEM_H) $(PARSER_H) $(BOX_H) \
				  $(SYSNAME_HASH_H) box.c
	$(CC) $(CFLAGS) -c -o $(OBJECT_DIR)/box.o box.c

$(OBJECT_DIR)/box-relations.o	: $(ERROR_H) $(MEM_H) $(BOX_H) $(BOX_G) \
				  $(BOX_RELATIONS_H) box-relations.c
	$(CC) $(CFLAGS) -c -o $(OBJECT_DIR)/box-relations.o box-relations.c

$(OBJECT_DIR)/sysname-hash.o	: $(ERROR_H) $(MEM_H) $(BOX_H) $(ARROW_H) \
				  $(SYSNAME_HASH_H) sysname-hash.c
	$(CC) $(CFLAGS) -c -o $(OBJECT_DIR)/sysname-hash.o sysname-hash.c

