view src/Makefile.in @ 609:cdc194110938

[project @ 1994-08-14 00:26:55 by jwe]
author jwe
date Sun, 14 Aug 1994 00:28:54 +0000
parents 0e591d3900dd
children cf16ec9a2428
line wrap: on
line source

#
# Makefile for octave's src directory
#
# John W. Eaton
# jwe@che.utexas.edu
# Department of Chemical Engineering
# The University of Texas at Austin

TOPDIR = ..

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@:@srcdir@/../bsd-math

include $(TOPDIR)/Makeconf

LIBOBJS = @LIBOBJS@

# Cancel default rule for .c from .y and make .cc from .y instead.

%.c : %.y

%.cc : %.y
	$(YACC) $(YFLAGS) $<
	@$(top_srcdir)/move-if-change y.tab.c $(@F)

# Likewise for .c from .l.

%.c : %.l

%.cc : %.l
	$(LEX) $(LFLAGS) $< > $(@F)

XALL_CXXFLAGS = $(subst -fexternal-templates, , $(ALL_CXXFLAGS))

%.def : %.cc
	@echo making $@ from $<
	@$(CXXCPP) -c $(CPPFLAGS) $(XALL_CXXFLAGS) -DMAKE_BUILTINS $< \
	  | $(srcdir)/mkdefs > $@.tmp
	@if test "`wc $@.tmp | awk '{print $3}'`" -ne 0 ; then \
	  mv $@.tmp $@ ; \
	else \
	  echo "error: $@ is empty!" 1>&2 ; \
	  rm -f $@.tmp ; \
	  exit 1 ; \
	fi

DLD_SRC = f-balance.cc f-chol.cc f-colloc.cc f-dassl.cc f-det.cc \
	f-eig.cc f-expm.cc f-fft.cc f-find.cc \
	f-fsolve.cc f-fsqp.cc f-givens.cc f-hess.cc f-ifft.cc \
	f-inv.cc f-log.cc f-lpsolve.cc f-lsode.cc f-lu.cc \
	f-minmax.cc f-npsol.cc f-qpsol.cc f-qr.cc f-quad.cc f-qzval.cc \
	f-rand.cc f-schur.cc f-sort.cc f-svd.cc f-syl.cc

DLD_OBJ = f-balance.o f-chol.o f-colloc.o f-dassl.o f-det.o f-eig.o \
	f-expm.o f-fft.o f-find.o f-fsolve.o \
	f-fsqp.o f-givens.o f-hess.o f-ifft.o f-inv.o \
	f-log.o f-lpsolve.o f-lsode.o f-lu.o f-minmax.o f-npsol.o \
	f-qpsol.o f-qr.o f-quad.o f-qzval.o f-rand.o f-schur.o \
	f-sort.o f-svd.o f-syl.o

INCLUDES = arith-ops.h builtins.h defaults.h.in defun.h defun-dld.h \
	defun-int.h dirfns.h dynamic-ld.h error.h file-io.h fnmatch.h \
	getopt.h gripes.h help.h idx-vector.h input.h lex.h \
	load-save.h mappers.h missing-math.h octave.h octave-hist.h \
	oct-obj.h pager.h parse.h pr-output.h procstream.h \
	sighandlers.h statdefs.h symtab.h sysdep.h token.h \
	tree-base.h tree-cmd.h tree-const.h tree-expr.h tree-misc.h \
	tree-plot.h tc-rep.h unwind-prot.h user-prefs.h utils.h \
	variables.h version.h xdiv.h xpow.h SLStack.h Stack.h

SOURCES = arith-ops.cc data.cc dirfns.cc dynamic-ld.cc \
	error.cc file-io.cc fnmatch.c getopt.c getopt1.c gripes.cc \
	help.cc idx-vector.cc input.cc lex.l load-save.cc mappers.cc \
	octave.cc oct-obj.cc octave-hist.cc pager.cc parse.y \
	pr-output.cc procstream.cc sighandlers.cc strcasecmp.c \
	strncase.c symtab.cc sysdep.cc tc-inlines.cc tc-rep.cc \
	timefns.cc token.cc tree-base.cc tree-cmd.cc tree-const.cc \
	tree-expr.cc tree-misc.cc tree-plot.cc unwind-prot.cc \
	user-prefs.cc utils.cc variables.cc xdiv.cc xpow.cc \
	SLStack.cc \
	$(DLD_SRC)

# Ugh.

DEP_SOURCES_2 = $(patsubst %.l, %.cc, $(SOURCES)) builtins.cc
DEP_SOURCES_1 = $(patsubst %.y, %.cc, $(DEP_SOURCES_2))
DEP_SOURCES = $(patsubst %.c, %.d, $(DEP_SOURCES_1))
MAKEDEPS = $(patsubst %.cc, %.d, $(DEP_SOURCES))

DEF_FILES_4 = $(addprefix $(srcdir)/, $(SOURCES))
DEF_FILES_3 = $(notdir $(shell grep -l "^DEFUN" $(DEF_FILES_4)))
DEF_FILES_2 = $(patsubst %.y, %.def, $(DEF_FILES_3))
DEF_FILES_1 = $(patsubst %.l, %.def, $(DEF_FILES_2))
DEF_FILES = $(patsubst %.cc, %.def, $(DEF_FILES_1))

# XXX FIXME XXX -- Should these be generated automatically from the
# list of source files?

OBJECTS = arith-ops.o builtins.o data.o dirfns.o error.o \
	file-io.o fnmatch.o getopt.o getopt1.o gripes.o help.o \
	idx-vector.o input.o lex.o load-save.o mappers.o octave.o \
	octave-hist.o oct-obj.o pager.o parse.o pr-output.o \
	procstream.o sighandlers.o strcasecmp.o strncase.o symtab.o \
	sysdep.o tc-rep.o timefns.o token.o tree-base.o tree-cmd.o \
	tree-const.o tree-expr.o tree-plot.o tree-misc.o unwind-prot.o \
	user-prefs.o utils.o variables.o xdiv.o xpow.o SLStack.o \
	@DYNAMIC_LD_OBJ@

OCTAVE_LIBS = @LIBOCTDLD@ ../liboctave.a ../libcruft.a ../libinfo.a \
	../libreadline.a @LIBDLD@

DISTFILES = Makefile.in mkdefs mkbuiltins \
	parse.cc lex.cc y.tab.h $(INCLUDES) $(SOURCES)

all: defaults.h octave
.PHONY: all

octave: $(OBJECTS) $(DLD_OBJ) $(LIBOBJS) $(OCTAVE_LIBS) ../liboctdld.a
	$(CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(ALL_LDFLAGS) -o octave \
	$(OBJECTS) \
	$(OCTAVE_LIBS) \
	$(LIBOBJS) \
	$(FLIBS) $(LEXLIB) -ltermcap -lm -lg++

../liboctdld.a: $(DLD_OBJ)
	$(AR) $(ARFLAGS) ../liboctdld.a $(DLD_OBJ)
	$(RANLIB) ../liboctdld.a

builtins.cc: $(DEF_FILES) mkbuiltins
	@echo making $@ from $(DEF_FILES)
	@$(srcdir)/mkbuiltins $(DEF_FILES) > $@.tmp
	@$(top_srcdir)/move-if-change $@.tmp $@

$(DEF_FILES): mkdefs defun-int.h defun-dld.h defun.h defaults.h

$(MAKEDEPS): defaults.h

check: all
.PHONY: check

install: all
	if test -d $(bindir) ; then true ; else $(TOPDIR)/mkpath $(bindir) ; fi
	rm -f $(bindir)/octave
	$(INSTALL) octave $(bindir)/octave-$(version)
	ln $(bindir)/octave-$(version) $(bindir)/octave
.PHONY: install

uninstall:
	rm -f $(bindir)/octave
.PHONY: uninstall

tags: $(SOURCES)
	ctags $(SOURCES)

TAGS: $(SOURCES)
	etags $(SOURCES)

clean:
	rm -f *.a *.o *.def builtins.cc
.PHONY: clean

mostlyclean:
	rm -f *.o
.PHONY: mostlyclean

distclean: clean
	rm -f Makefile octave .fname *.d
.PHONY: distclean

realclean: distclean
	rm -f tags TAGS y.tab.c y.tab.h y.output yy.lex.c \
	lex.cc parse.cc defaults.h *.d
.PHONY: realclean

local-dist: parse.cc lex.cc
	ln $(DISTFILES) ../`cat ../.fname`/src
	rm -f parse.cc lex.cc y.tab.h y.output yy.lex.c \
	lex.cc parse.cc defaults.h
.PHONY: local-dist

dist: parse.cc lex.cc
	ln $(DISTFILES) ../`cat ../.fname`/src
	rm -f parse.cc lex.cc y.tab.h y.output yy.lex.c \
	lex.cc parse.cc defaults.h
.PHONY: dist

# Special rules -- these files need special things to be defined.

defaults.h: defaults.h.in ../Makeconf Makefile
	@echo "making defaults.h from defaults.h.in"
	@(sed < $< > $@.tmp \
	  -e 's;%DEFAULT_PAGER%;\"${DEFAULT_PAGER}\";' \
	  -e 's;%OCTAVE_HOME%;\"${OCTAVE_HOME}\";' \
	  -e 's;%OCTAVE_LIB_DIR%;\"${OCTAVE_LIB_DIR}\";' \
	  -e 's;%OCTAVE_INFO_DIR%;\"${OCTAVE_INFO_DIR}\";')
	@$(top_srcdir)/move-if-change $@.tmp $@

include $(MAKEDEPS)