#-----[ Directory ]----------------------------------------
DIR_DOC				= doc
DIR_LIB				= lib
DIR_TEST			= SelfTest

#-----[ Variable ]-----------------------------------------
OBJECTS				= $(OBJECTS_COMMON)

#-----[ Rules ]--------------------------------------------
.PRECIOUS			: $(DIR_LIB)/%.a
.NOPARALLEL			: clean help

all_component			: test_env $(DIR_OBJ) $(DIR_LIB) $(OBJECTS) $(HEADERS)
				@$(MAKE) $(LIBRARY)

$(DIR_LIB)/%.a			: $(OBJECTS) $(HEADERS)
				@\
				$(ECHO) "Archive            : $*";\
				$(AR)  -r $@ $(OBJECTS);\
				$(RANLIB) $@;

$(DIR_LIB)			:
				@\
				$(ECHO) "Create directory   : $@";\
				$(MKDIR) $@;

document			:
				@$(MAKE) --directory=$(DIR_DOC) --makefile=Makefile

component_clean			:
				@$(RM) $(DIR_LIB)
				
component_help			:
				@\
				$(ECHO) " -----[ Component ]----------------------------------";\
				$(ECHO) "";\
				$(ECHO) " * all_component        : compile all c++ file and generate library";\
				$(ECHO) " * document             : Generate documantation";\
				$(ECHO) " * clean                : Erase all generate files";\
				$(ECHO) " * help                 : print this text";\
				$(ECHO) "";
				

help				: 
				@\
				$(MAKE) common_help;\
				$(MAKE) component_help;

clean				: 
				@\
				$(MAKE) common_clean ;\
				$(MAKE) component_clean;\
				if $(TEST) -d $(DIR_DOC); then $(MAKE) --directory=$(DIR_DOC) --makefile=Makefile clean; fi;
