# Makefile for the mpeg_edit programme (editor directory)
#
#  Copyright (C) 1995 Alexis Ashley
# 
#  email:	milamber@ripley.demon.co.uk
#
#  mail:	Mr A S Ashley, 61/63 Underwood Road, Plympton, Plymouth,
#		Devon, PL7 3SZ, ENGLAND
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#                       Mr A S R Ashley B.Eng (Hons)    23rd July 1995
#

AR       = ar r
CC       = gcc
CPP      = g++
RM       = rm -f
RANLIB   = ranlib

INCLUDES = -I../ui -I../editor -I../globals -Iencoder -Idecoder
DEPFILE  = Dependancies
SUBDIRS  = decoder encoder
HEADERS  = bstream.H frame.H mpeg.H
SOURCES  = bstream.C frame.C mpeg.C
OBJS     = bstream.o frame.o mpeg.o
OTHERS   = Makefile
ALL      = mpeg.a

.SUFFIXES:	.C $(SUFFIXES) 

.C.o:	
	$(CPP) $(CPPFLAGS) $(INCLUDES) $(CACHE_FLAGS) $(EXTRA) -c $< 

all:	$(ALL) 

force:
	$(RM) mpeg.a
	make mpeg.a

mpeg.a: $(DEPFILE) $(OBJS) 
	$(RM) $@ 
	$(AR) $@ $(OBJS)
	set -e; for i in $(SUBDIRS); do cd $$i && make ar CFLAGS="$(CFLAGS)" ; cd ..; done
	$(RANLIB) $@ 

clean:
	set -e; for i in $(SUBDIRS); do cd $$i && make clean && cd ..; done
	rm -f mpeg.a $(OBJS) $(DEPFILE)

FORCE:


dep:	FORCE
	set -e; for i in $(SUBDIRS); do cd $$i && make dep && cd ..; done
	$(RM) $(DEPFILE) 	
	make $(DEPFILE)

$(DEPFILE):
	set -e; for i in $(SOURCES) ; do $(CC) $(INCLUDES) -M $$i >>$(DEPFILE) ; done
	
#
# include a dependency file if one exists
#
#ifeq ($(DEPFILE),$(wildcard $(DEPFILE)))
include $(DEPFILE)
#endif
