# @(#) $Revision: 78.2 $
#
# Common makefile for libBUILD.a
#
# libBUILD.a  -- is a library containing utilities that are not shipped
#                to customers, but are used to build commands.
#

REGULAR_SOURCES = nl_affirm.c NLSrtns.c unicode_str.c toolong.c
LARGE_SOURCES = parsemode.c walkfs.c toolong.c

REGULAR_OBJECTS = nl_affirm.o NLSrtns.o unicode_str.o toolong.o
LARGE_OBJECTS = parsemode.o walkfs.o toolong.o

BE_REGULAR_SOURCES = nl_affirm.c NLSrtns.c unicode_str.c toolong.c
BE_LARGE_SOURCES = parsemode.c toolong.c walkfs_BE.c

BE_REGULAR_OBJECTS = nl_affirm.o NLSrtns.o unicode_str.o toolong.o
BE_LARGE_OBJECTS = parsemode.o walkfs_BE.o toolong.o

LIB	= libBUILD.a
LIB_M	= libBUILD.M
LIB_BE	= libBUILD_BE.a

LARGE_DOPTS = -D _FILE_OFFSET_BITS=64 -D __STDC_EXT__

default: belib $(LIB) copy_headers

metrics: $(LIB_M)

belib: $(LIB_BE)

$(LIB):  
	rm -f $(LIB)
	$(CC) -c hpux_rel.c
	$(CC) -c $(REGULAR_SOURCES)
	ar qc $(LIB) hpux_rel.o $(REGULAR_OBJECTS)
	$(CC) -c $(LARGE_DOPTS) $(LARGE_SOURCES)
	ar qc $(LIB) $(LARGE_OBJECTS)

$(LIB_BE):  
	rm -f $(LIB_BE)
	$(CC) -c hpux_rel.c
	$(CC) -c $(BE_REGULAR_SOURCES)
	ar qc $(LIB_BE) hpux_rel.o $(BE_REGULAR_OBJECTS)
	$(CC) -c $(LARGE_DOPTS) $(BE_LARGE_SOURCES)
	ar qc $(LIB_BE) $(BE_LARGE_OBJECTS)

$(LIB_M):  hpux_rel.c $(SOURCES)
	$(METRICS) hpux_rel.c $(SOURCES) -o $(LIB_M)

copy_headers:
	if cmp -s walkfs.h /usr/include/walkfs.h 2>&1; then	\
	    : walkfs.h is up to date;				\
	else							\
	    cp walkfs.h /usr/include/walkfs.h;			\
	    chmod 444   /usr/include/walkfs.h;			\
	    chgrp bin   /usr/include/walkfs.h;			\
	    chown bin   /usr/include/walkfs.h;			\
	fi

clean:
	rm -f *.o

clobber: clean
	rm -f $(LIB) $(LIB_M) $(LIB_BE)
