
include subdirs.file

AGBINC		=	$(AGBDIR)/include/
AGBLIB		=	$(AGBDIR)/lib/

.CFILES		=	res_data.c

.HFILES		=	res_data.h res_id.h

.OBJFILES	=	$(.CFILES:.c=.o)

include $(PROJECT)/MakeInclude

TARGETLIB	=	libres.a

DEPENDFILE	=	DepMakefile

HISFILE		=	history	

default: make_subdirs $(TARGETLIB)

all: clean depend default

$(.CFILES): history
	$(TOOLSDIR)/res_pack.exe
	
$(TARGETLIB):$(.OBJFILES)
	$(AR) -r $@ $(.OBJFILES)

make_subdirs:
	@for d in $(SUBDIRS) ; do \
		if [ -e $$d/GNUmakefile ] ; then \
			$(MAKE) -C $$d -f GNUmakefile; \
		fi; \
	done

clean_subdirs:
	@for d in $(SUBDIRS) ; do \
		if [ -e $$d/GNUmakefile ] ; then \
			$(MAKE) -C $$d -f GNUmakefile clean; \
		fi; \
	done
	
clean: clean_subdirs
	rm -rf $(.CFILES) $(.HFILES) $(.OBJFILES) $(TARGETLIB) *.bin

depend:
	$(CC) $(CFLAGS) -M $(.CFILES) > DepMakefile
	
-include $(DEPENDFILE)	