#############################################################
#
# igmprt
#
#############################################################
#
ACCUTIL_BUILD_DIR=$(BASE_DIR)/../fusiv_src/user/acc_utillib
ACCUTIL_TARGET_BINARY:=miscutillib.a
LINUX_SRC = $(BASE_DIR)/../fusiv_src

AR = $(TOOLCHAIN_DIR)/bin/mips-linux-ar
RANLIB = $(TOOLCHAIN_DIR)/bin/mips-linux-ranlib

ifeq ("$(strip $(DEFAULT_KERNEL_HEADERS))","2.6.12")
MISC_HEADERS_DIR="-I$(BASE_DIR)/../linux-mips-2.6.12/include -I$(LINUX_SRC)/kernel -I$(BASE_DIR)/build_mips_nofpu"
endif
ifeq ("$(strip $(DEFAULT_KERNEL_HEADERS))","2.6.18")
MISC_HEADERS_DIR="-I$(BASE_DIR)/../linux-2.6.18/include -I$(LINUX_SRC)/kernel -I$(BASE_DIR)/build_mips_nofpu"
endif

ATM_HEADERS_DIR =
CC_COMPILER     = $(TARGET_CC)

$(ACCUTIL_BUILD_DIR)/.configured:
	(cd $(ACCUTIL_BUILD_DIR); rm -rf Makefile .configured; \
	./configure $(MISC_HEADERS_DIR) $(AR) $(RANLIB) $(CC_COMPILER);\
	);
	touch $(ACCUTIL_BUILD_DIR)/.configured

$(ACCUTIL_BUILD_DIR)/miscutillib.a: $(ACCUTIL_BUILD_DIR)/.configured
	$(MAKE) -C $(ACCUTIL_BUILD_DIR)

$(TARGET_DIR)/$(ACCUTIL_TARGET_BINARY): $(ACCUTIL_BUILD_DIR)/miscutillib.a

acc_utillib: $(TARGET_DIR)/$(ACCUTIL_TARGET_BINARY)

acc_utillib-clean:
	rm -f $(ACCUTIL_BUILD_DIR)/*.o $(ACCUTIL_BUILD_DIR)/miscutillib.a
	rm -f .configured

acc_utillib-dirclean:
	rm -rf $(ACCUTIL_BUILD_DIR)

#############################################################
#
# Toplevel Makefile options
#
#############################################################
ifeq ($(strip $(CONFIG_FUSIV_USER_ACCUTILLIB)),y)
TARGETS+=acc_utillib
endif
