#
# General Applications Library makefile
# Copyright (C) ARM Limited 1998-1999. All rights reserved.
#

# ROOTDIRECTORY is defined on entry

# Define general directory hierarchy

INCLUDES_DIR	= include/
SRC_DIR		= src/
TESTFILES_DIR	= tstfiles/
UTILLIB_DIR	= util_lib/

# Define Utility Library library file

UTILLIB_LIB	= util_lib

# Define all the C object files

C_OBJECTS 	= 		\
	$(LIB_C_OBJECTS)	\
	$(EXE_C_OBJECTS)

# Define all the Assembler object files

AS_OBJECTS 	= 		\
	$(LIB_AS_OBJECTS)	\
	$(EXE_AS_OBJECTS)

# Define all the library object files

LIB_OBJECTS 	= 		\
	$(LIB_C_OBJECTS)	\
	$(LIB_AS_OBJECTS)

# Define all the executable object files

EXE_OBJECTS 	= 		\
	$(EXE_C_OBJECTS) 	\
	$(EXE_AS_OBJECTS)

# Define the utility library include for all projects

INCLUDE_UTILLIB_DIR	= 	\
	$(ROOTDIRECTORY)$(UTILLIB_DIR)$(SRC_DIR)

# Define the include directories

INCLUDES 	= $(INCLUSIONS)$(INCLUDE_UTILLIB_DIR)

# Define the targets

BINARIES 	= $(LIBRARY:%=% )$(BINARY)

# Define subprojects

SUBPROJECTS 	= $(SUBPROJS) $(ROOTDIRECTORY)$(UTILLIB_DIR)

# Define the variants supported

WHICHVARIANTS 	= 		\
	ArmBigDebug 		\
	ArmBigRelease 		\
	ArmLittleDebug 		\
	ArmLittleRelease 	\
	ThumbBigDebug 		\
	ThumbBigRelease 	\
	ThumbLittleDebug 	\
	ThumbLittleRelease

# Include the generic makefile

include $(ROOTDIRECTORY)makedefs

# Define link rule to create a compontent library

$(LIBRARY): $(LIB_OBJECTS)
	$(AR) $(ARFLAGS) $(LIBRARY) $(LIB_OBJECTS)

# Define link rule to create binary including libraries

$(BINARY): $(EXE_OBJECTS) $(LIBRARIES)
	$(LD) -rw-base 0x40000 $(LDFLAGS)					\
		$(BINARY)							\
		$(EXE_OBJECTS)							\
		$(LIBRARIES)							\
		$(ROOTDIRECTORY)$(UTILLIB_DIR)$(OBJDIR)$(UTILLIB_LIB).alf	\
		$(CLIB)
