# Makefile for /usr/miro/src/lib/extract
#
#/*****************************************************************************
#                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 =	extract
OUTPUT_LIB =	$(OBJECT_DIR)/$(LIB_NAME).a
LINT_LIB =	$(OBJECT_DIR)/llib-l$(LIB_NAME).ln
SOURCE = 	convert.c extract.c
OBJ =		$(SOURCE:.c=.o)
OBJECTS =	$(OBJ;.*;$(OBJECT_DIR)/&)
GLOBALS =	
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) -DDEBUG -DASSERT

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

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

LDFLAGS = -L$(LIB_DIR)

all: $(MYPROGRAMS)

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

$(LINT_LIB) lintlib: $(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:

# .SUFFIXES: .out .u .s .c .f .e .r .y .l .p
#
# .c.u:
#	cc -j $(CFLAGS) $*.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/extract-headers

# Object files depending on header files
$(OBJECT_DIR)/convert.o	: $(ERROR_H) $(PARSER_H) $(CONVERT_H) convert.c
	$(CC) $(CFLAGS) -c -o $(OBJECT_DIR)/convert.o convert.c

$(OBJECT_DIR)/extract.o	: $(ERROR_H) $(MEM_H) $(PARSER_H) $(PARSER_G)\
			  $(CONVERT_H) $(EXTRACT_H)
	$(CC) $(CFLAGS) -c -o $(OBJECT_DIR)/extract.o extract.c

