# Makefile for octave's libcruft/misc directory
#
# Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003,
#               2006, 2007, 2008 John W. Eaton
#
# This file is part of Octave.
# 
# Octave 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 3 of the License, or (at
# your option) any later version.
# 
# Octave 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 Octave; see the file COPYING.  If not, see
# <http://www.gnu.org/licenses/>.

TOPDIR = ../..

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

EXTERNAL_DISTFILES = $(DISTFILES)

FSRC = d1mach.f r1mach.f i1mach.f

CSRC = machar.c f77-fcn.c lo-error.c cquit.c

CXXSRC = f77-extern.cc quit.cc

CEXTRA = smachar.c

MAKEDEPS := $(patsubst %.c, %.d, $(CSRC)) $(patsubst %.cc, %.d, $(CXXSRC))

INCLUDES := f77-fcn.h lo-error.h oct-dlldefs.h quit.h

SPECIAL:= d1mach-tst.for $(INCLUDES)

include $(TOPDIR)/Makeconf

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

include ../Makerules

install install-strip::
	$(top_srcdir)/mkinstalldirs $(DESTDIR)$(octincludedir)/octave
	for f in $(INCLUDES); do \
	  rm -f $(DESTDIR)$(octincludedir)/octave/$$f; \
	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(octincludedir)/octave/$$f; \
	done
	$(mk-includedir-link)

uninstall::
	for f in $(INCLUDES); do rm -f $(DESTDIR)$(octincludedir)/octave/$$f; done

# Don't optimize.

XCC = $(patsubst -O%, , $(CC))
XALL_CFLAGS = $(patsubst -O%, , $(ALL_CFLAGS))

machar.o: $(srcdir)/machar.c
	$(XCC) -c $(CPPFLAGS) $(XALL_CFLAGS) -DDP $< -o $@

smachar.o: $(srcdir)/machar.c
	$(XCC) -c $(CPPFLAGS) $(XALL_CFLAGS) -DSP $< -o $@

pic/machar.o: $(srcdir)/machar.c
	$(XCC) -c $(CPPFLAGS) $(CPICFLAG) $(XALL_CFLAGS) -DDP $< -o $@

pic/smachar.o: $(srcdir)/machar.c
	$(XCC) -c $(CPPFLAGS) $(CPICFLAG) $(XALL_CFLAGS) -DSP $< -o $@

ifdef omit_deps
.PHONY: $(MAKEDEPS)
endif

-include $(MAKEDEPS)
