# -----------------------------------------------------------------------------
# Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
#
# 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 (at your option) 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
# -----------------------------------------------------------------------------
#
# $Id: Makefile,v 1.6 2000/12/10 21:46:50 daniel Exp $

CXX=g++
INCLUDES=
CXXFLAGS=-Wall -ansi -pedantic -D_GNU_SOURCE  $(INCLUDES) 

OBJS=denef.o nefdata.o tifffile.o ifd.o ifdentry.o interp.o \
     interp_null.o \
     interp_basic.o \
     interp_rgb.o \
     interp_gradlumin.o \
     interp_lumin.o  \
     options.o	

HDRS=

DEPS=$(OBJS:.o=.dep)

##### TARGETS ######

default:	denef

clean:
	-rm *.o *~ *.dep

realclean:
	-rm denef
	-rm *.o *~

denef:	$(OBJS)
	$(CXX) $(CXXFLAGS) $(OBJS) -o denef -lm

# Dependency rules
dependencies:	Makefile $(DEPS)
		cat $(DEPS) > dependencies-
		mv -f dependencies- dependencies

# Each .dep file will hold dependencies for both the .o file, and an identical
# list to determine when the .dep file needs rebuilding. Clever eh?
%.dep: %.cc $(HDRS)
		$(CXX) $(CFLAGS) $(INCS) -M -E -c $*.cc > $*.dep-
		sed -e 's/[.]o:/.dep:/' $*.dep- > $*.dep--
		cat $*.dep-- >> $*.dep-
		rm -f $*.dep--
		mv -f $*.dep- $*.dep 

include dependencies

