#
# $Id: Makefile,v 1.1 2004/12/21 23:26:20 tjm Exp $
#
# This file is part of libconfig.
# A library which provides a framework for managing system hardware
# and software configuration information.
#
# Created by Silicon Graphics, Inc.
#
# Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
#
# This code is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version. See the file COPYING for more
# information.
#
DEPTH        = ..
-include $(DEPTH)/../.config

EXTRA_CFLAGS = $(GFLAGS) -DARCH=$(ARCH) 

# set up include directory search order
EXTRA_CFLAGS += -I$(TOPDIR)/include -I. -I../libklib/include -I../liballoc \
	-I../libutil

# Turn on strict protype and error checking
EXTRA_CFLAGS += -Wall -Wstrict-prototypes

LIBCONFIG = liblkcd_config.a
TARGETS = $(LIBCONFIG) 
CFILES  = hwconfig.c swconfig.c sysconfig.c
HFILES  = kl_config.h kl_hwconfig.h kl_swconfig.h kl_sysconfig.h
OFILES  = $(CFILES:.c=.o)

all: default

default: $(TARGETS)

clean:
	/usr/bin/find . -name ".[a-Z]*.flags" -print | xargs /bin/rm -f
	/usr/bin/find . -name ".depend" -print | xargs /bin/rm -f
	/bin/rm -f *.o

mrproper clobber: clean
	/bin/rm -f $(TARGETS)

$(TARGETS): $(OFILES)
	$(AR) ccurl $(LIBCONFIG) $(OFILES)

headers: 
	mkdir -p $(ROOT)/usr/include/lkcd
	install -m 644 $(HFILES) $(ROOT)/usr/include/lkcd

exports install: $(TARGETS) headers
	mkdir -p $(ROOT)/usr/lib/lkcd
	install -m 644 $(TARGETS) $(ROOT)/usr/lib/lkcd

include $(DEPTH)/../Rules.make
