home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
fchk294s.zip
/
ftnchek-2.9.4
/
makefile.unix
< prev
next >
Wrap
Makefile
|
1996-02-11
|
16KB
|
479 lines
#=======================================================================
# UNIX version of Makefile for Fortran program checker
#
# WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
# This makefile is no longer being maintained. To customize
# for your system, edit Makefile.in instead, and run configure.
# This makefile is here only for convenience in case configure
# gives trouble or cannot be used. This makefile works
# for ftnchek v2.9, but will not be updated for later versions.
#
# Current target list:
# TAGS
# all build ftnchek and its documentation files
# blurb.txt
# check run validation test suite
# clean remove unnecessary intermediate files
# clobber make clean, and remove ftnchek executable
# dcl2inc.doc ASCII form of documentation
# dcl2inc.ps PostScript form of documentation
# distclean remove everything that can be rebuilt
# docs documentation files
# fortran.c translate yacc code to C
# ftnchek ftnchek executable program
# ftnchek.1 UNIX manual page document
# ftnchek.doc ASCII form of documentation
# ftnchek.hlp VAX/VMS HELP library source
# ftnchek.ps PostScript form of documentation
# install install ftnchek and dcl2inc and their man pages
# install-exe install ftnchek and dcl2inc executables
# install-man install only man pages
# install-man-sgi install only man pages on SGI systems
# lint run lint on source code
# mostlyclean same as clean
# prog same as ftnchek
# realclean same as clobber
# spotless make distclean, then remove formatted
# documentation (do NOT do this if you don't
# have groff or nroff/troff to recreate the
# documentation!)
# TAGS emacs editor tags file
# tags ex and vi editor tags file
# uninstall undo an ftnchek installation
#
# Object file targets:
# ftnchek.o
# exprtype.o
# forlex.o
# fortran.o
# pgsymtab.o
# plsymtab.o
# project.o
# symtab.o
#
# Machine-specific convenience targets:
# DEC-ALPHA DEC Alpha OSF/1 and OpenVMS
# DJGPP IBM PC/DOS djgpp compiler
# GENERIC most UNIX systems
# HP HP 9000/7xx HP-UX 9.x
# IBM-RS6000 IBM RS/6000-xxx AIX 3.2
# LINUX Linux on 386
# LINUX-486 Linux on 486 and up
# MIPS-MIPS MIPS RC6280 RISCos 2.1.1
# SGI Silicon Graphics IRIX 4.x and 5.x
# SGI-INSTALL SGI special install for man page
# SOLARIS2.x Sun Solaris 2.x
# SOLARIS2.x-gcc Sun Solaris 2.x with GNU gcc
# SOLARIS2.x-apcc Sun Solaris 2.x with Apogee apcc
# STARDENT Stardent 15xx OS 2.2
# SUNOS5.x Sun SunOS 5.x (same as Solaris 2.x)
# SUNOS5.x-gcc Sun SunOS 5.x (same as Solaris 2.x) with
# GNU gcc
# SUNOS5.x-apcc Sun SunOS 5.x (same as Solaris 2.x)
# with Apogee apcc
# SUNOS4.0 Sun SunOS 4.0
# SUNOS4.1 Sun SunOS 4.1
# ULTRIX-MIPS DECstation ULTRIX 4.x
# UNIX most UNIX systems
#
# For each of these machine-specific targets, you can modify what is
# built by defining a value for TARGETS on the make command line
# (default: ftnchek).
#
#
# Copyright (C) 1991 by Robert K. Moniot.
# This program is free software. Permission is granted to
# modify it and/or redistribute it, retaining this notice.
# No guarantees accompany this software.
#
# Acknowledgements and thanks to Nelson H. F. Beebe of the University
# of Utah for improvements to this Makefile.
# [25-Apr-1994]
#=======================================================================
# These definitions should be customized for your local conventions
# if you want to do "make install" or "make uninstall"
BINDIR = /usr/local/bin
LIBDIR = /usr/local/lib/ftnchek
MANDIR = /usr/local/man
#NROFF = groff # if you have groff, but not nroff
NROFF = nroff
#STRIP = echo >/dev/null # if your system lacks strip
STRIP = strip
# The following is only used for targets ftnchek.doc and ftnchek.hlp
# which are not needed for unix platforms. It removes control chars
# and converts tabs to blanks.
#COL = /usr/5bin/col -bx # For BSD-like systems
COL = col -bx # For System V-like systems
# Editor tags file support
CTAGS = ctags
CTAGSFLAGS = -t
ETAGS = etags
# For "make check", we need new awk, either AT&T nawk or GNU gawk.
# However, IBM RS/6000 AIX calls it awk.
#NAWK = awk
#NAWK = gawk
NAWK = nawk
# These system utilities should be standard on all UNIX systems
CHMOD = /bin/chmod
CP = /bin/cp
MKDIR = /bin/mkdir
MV = /bin/mv
RM = /bin/rm -f
RMDIR = /bin/rmdir
SED = /bin/sed
SHELL = /bin/sh
TR = /usr/ucb/tr
FTNCHEK = ./ftnchek
MAN2PS = ./man2ps
# YACC =parser name, YSTEM=stem on tab.c, tab.h
# for yacc as the parser
YACC = yacc
YSTEM = y
# for GNU bison as the parser
#YACC = bison
#YSTEM = fortran
# OPTIONS is used to define various characteristics. Most commonly
# needed ones are given below; uncomment whichever you like.
# See ftnchek.h for others, with their defaults and explanations.
# To use the defaults for everything uncomment this:
OPTIONS =
# To make all table sizes 10x bigger than defaults uncomment this:
#OPTIONS = -DLARGE_MACHINE
# To allow the -vcg option uncomment this:
#OPTIONS = -DVCG_SUPPORT
# To prohibit underscores in variable names, inline comments
# starting with '!', the DO ... ENDDO loop forms and INCLUDE statements:
#OPTIONS = -DSTRICT_SYNTAX
# CFLAGS is used to define the operating system and options
# Other
CFLAGS = -DUNIX $(OPTIONS) -O -D_BSD
LDFLAGS =
YFLAGS = -d
# fortran.o first because of possible remake if tokdefs.h changes (see below)
OBJS = fortran.o exprtype.o forlex.o ftnchek.o \
pgsymtab.o plsymtab.o project.o symtab.o
SRCS = exprtype.c forlex.c fortran.c ftnchek.c \
ftnchek.h intrins.h iokeywds.h keywords.h newarge.c \
newargh.c newcome.c newcomh.c pgsymtab.c plsymtab.c \
project.c shell_mung.c symtab.c symtab.h tokdefs.h \
y.tab.h
#=======================================================================
prog: ftnchek
all: ftnchek docs
check:
cd test; $(MAKE) NAWK="$(NAWK)" -i -s check
lint:
lint $(LINTFLAGS) $(OBJS:.o=.c) -lm
# Remove intermediate files that are not required after the program is
# built.
clean mostlyclean:
-$(RM) *.o
-$(RM) \#*
-$(RM) a.out
-$(RM) *~
-$(RM) core
# Remove almost everything that make can rebuild
clobber realclean: clean
-$(RM) fortran.c
-$(RM) ftnchek
# dcl2inc.doc is ascii text form of documentation. It should not matter
# whether dcl2inc.1 or dcl2inc.man is used here.
dcl2inc.doc: dcl2inc.man
$(NROFF) -man dcl2inc.man | $(COL) >dcl2inc.doc
dcl2inc.ps: dcl2inc.man
$(MAN2PS) <dcl2inc.man >dcl2inc.ps
# Remove everything that make can rebuild, preparatory to making a
# distribution version. We intentionally do NOT remove .ps and .doc
# files, because some UNIX systems lack nroff/troff/groff.
distclean: realclean
-$(RM) *.dcl
-$(RM) cscope.out
-$(RM) tags
-$(RM) TAGS
-$(RM) ftnchek.1
docs: blurb.txt dcl2inc.doc dcl2inc.ps ftnchek.doc \
ftnchek.hlp ftnchek.ps
ftnchek: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o ftnchek $(OBJS) -lm
# Documentation targets: If you make changes to the documentation,
# you should edit only ftnchek.man and then re-make these targets.
# If ftnchek.1 fails to make, ftnchek.man is usable directly except
# that some troff-like processors may not give satisfactory results.
#
# Following sed script trims out the if-else machinery contained in
# ftnchek.man to produce a clean nroff document. The lines of the
# script correspond to the following actions:
# 1. remove text between lines of form ``.if \nh \{'' or .ie \nh \{''
# and lines of form ``\}'' (these are the help-related additions)
# 2. remove lines of form ``.if !\nh \{'' (these preface man text)
# Also remove ``.if !\nb \{'' which are for blurb.
# 3. remove lines of form ``.el \{'' (start of the else sections of
# the .if's of step 1)
# 4. remove lines of form ``\}'' (closures of step 3 lines)
# 5. remove lines of form ``.ie \nh text'' (one-liner help text)
# 6. change lines of form ``.el \nh text'' to ``text'' (these are
# one-liner man text)
# 7. change lines of form ``.if !\nh text'' to ``text'' (ditto)
ftnchek.1: ftnchek.man
$(SED) -e '/^\.i[fe] \\nh \\{/,/^\\}$$/d' \
-e '/^\.if !\\n[bh] \\{/d' \
-e '/^\.el \\{/d' \
-e '/^\\}/d' \
-e '/^\.i[fe] \\nh /d' \
-e 's/^\.el *\(.*\)$$/\1/' \
-e 's/^\.if !\\nh *\(.*\)$$/\1/' \
< ftnchek.man > ftnchek.1
# ftnchek.doc is ascii text form of documentation. It should not matter
# whether ftnchek.1 or ftnchek.man is used here.
ftnchek.doc: ftnchek.man
$(NROFF) -man ftnchek.man | $(COL) >ftnchek.doc
# ftnchek.ps is PostScript form of documentation.
ftnchek.ps: ftnchek.man
@make ftnchek.1
$(MAN2PS) <ftnchek.1 >ftnchek.ps
# blurb.txt is an ascii file for informational mailings.
blurb.txt: ftnchek.man
$(NROFF) -man -rb1 ftnchek.man | $(COL) >blurb.txt
# ftnchek.hlp is a VMS HELP library source document:
# create ftnchek.hlb with $ LIBR/CREATE/HELP FTNCHEK.HLB FTNCHEK.HLP
# The leading and trailing newlines in ftnchek.hlp should be removed.
ftnchek.hlp: ftnchek.man
$(SED) -e '1d' ftnchek.man | \
$(NROFF) -man -rh1 | $(COL) | \
$(SED) -e 's/^-\([a-zA-Z][a-zA-Z]*\)/\/\1/' \
-e 's/\([^a-zA-Z]\)-\([a-zA-Z][a-zA-Z]*\)/\1\/\2/g' \
>ftnchek.hlp
#
# N.B. tokdefs.h is copy of y.tab.h used to avoid remaking stuff when
# grammar changes but not tokens.
# The following copies y.tab.h to tokdefs.h if changed, then aborts make,
# since dependencies may have changed.
fortran.c: fortran.y
$(YACC) $(YFLAGS) fortran.y
$(MV) $(YSTEM).tab.c fortran.c
@if cmp -s $(YSTEM).tab.h tokdefs.h ; then true ; else \
echo; echo tokdefs.h changed -- repeat make ; \
$(CP) $(YSTEM).tab.h tokdefs.h; \
false ; \
fi
# Install program and documentation on system. Obsolete fcl2vcg script
# & doc is removed if present.
install: install-exe install-man
install-exe: ftnchek
$(CP) ftnchek $(BINDIR)
-$(STRIP) $(BINDIR)/ftnchek
$(CHMOD) 755 $(BINDIR)/ftnchek
-$(MKDIR) $(LIBDIR)
$(CP) dcl2inc.awk $(LIBDIR)/dcl2inc.awk
$(CHMOD) 644 $(LIBDIR)/dcl2inc.awk
$(SED) -e 's@^LIBDIR=.*$$@LIBDIR=$(LIBDIR)@' -e 's/nawk/$(NAWK)/' \
<dcl2inc.sh >$(BINDIR)/dcl2inc
$(CHMOD) 755 $(BINDIR)/dcl2inc
-$(RM) $(BINDIR)/fcl2vcg
# Install man pages, taking care to remove old formatted ones, because
# many man implentations fail to compare time stamps of raw and
# formatted files, and will show out-of-date formatted files.
install-man: ftnchek.1
$(CP) dcl2inc.man $(MANDIR)/man1/dcl2inc.1
-$(RM) $(MANDIR)/cat1/dcl2inc.1
$(CHMOD) 644 $(MANDIR)/man1/dcl2inc.1
$(CP) ftnchek.1 $(MANDIR)/man1/ftnchek.1
-$(RM) $(MANDIR)/cat1/ftnchek.1
$(CHMOD) 644 $(MANDIR)/man1/ftnchek.1
-$(RM) $(MANDIR)/man1/fcl2vcg.1
-$(RM) $(MANDIR)/cat1/fcl2vcg.1
# Remove everything that the install target installed.
uninstall:
-$(RM) $(BINDIR)/dcl2inc
-$(RM) $(BINDIR)/ftnchek
-$(RM) $(LIBDIR)/dcl2inc.awk
-$(RM) $(MANDIR)/cat1/dcl2inc.1
-$(RM) $(MANDIR)/cat1/ftnchek.1
-$(RM) $(MANDIR)/ftnchek.z # SGI
-$(RM) $(MANDIR)/man1/dcl2inc.1
-$(RM) $(MANDIR)/man1/ftnchek.1
-$(RMDIR) $(LIBDIR)
# WARNING: do NOT execute this target, unless you have nroff/troff or groff
# to recreate the formatted documentation files.
spotless: distclean
$(RM) blurb.txt
$(RM) dcl2inc.doc
$(RM) dcl2inc.ps
$(RM) ftnchek.doc
$(RM) ftnchek.hlp
$(RM) ftnchek.ps
# ex and vi editor tags file
tags: $(SRCS)
$(CTAGS) $(CTAGSFLAGS) *.[ch]
# emacs editor tags file
TAGS: $(SRCS)
$(ETAGS) *.[ch]
#=======================================================================
# Object file dependencies on include files
ftnchek.o: ftnchek.h
exprtype.o: ftnchek.h symtab.h tokdefs.h
forlex.o: ftnchek.h keywords.h symtab.h tokdefs.h
fortran.o: ftnchek.h symtab.h fortran.c
pgsymtab.o: ftnchek.h symtab.h
plsymtab.o: ftnchek.h symtab.h
project.o: ftnchek.h symtab.h
symtab.o: ftnchek.h iokeywds.h intrins.h symtab.h tokdefs.h
#=======================================================================
# Machine specific targets to build ftnchek with suitable compile options.
# Use 'MAKE_OPTIONS= "YACC=/usr/local/gnu/bin/bison" "YSTEM=fortran"'
# to select GNU bison parser, if you have touched fortran.y.
TARGETS = ftnchek
# On DEC Alpha systems, compilers default to fast non-IEEE-754-conformant
# arithmetic that is incapable of handling denormalized numbers,
# Infinity, and NaN. ftnchek can die on at least test/complex.f if IEEE
# 754 behavior is not restored with -ieee_with_inexact. The -Olimit
# value increases the optimizer table sizes.
DEC-ALPHA:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -O -D_BSD" \
"CC = c89 -ieee_with_inexact -Olimit 1000" $(MAKE_OPTIONS) \
$(TARGETS)
# target for djgpp on IBM PC by Judah Milgram, U. Maryand College Park
DJGPP:
$(MAKE) 'CFLAGS= $(OPTIONS) -DLARGE_MACHINE -O' \
$(MAKE_OPTIONS) $(TARGETS)
coff2exe ftnchek
del ftnchek
GENERIC LINUX STARDENT UNIX:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -O -D_BSD" \
$(MAKE_OPTIONS) $(TARGETS)
# Add compiler flag to eliminate optimizer table overflow
HP:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -O -D_BSD +Obb700" \
$(MAKE_OPTIONS) $(TARGETS)
IBM-RS6000:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) \
-DAIXC -DRAND_NO_ARG -O -D_BSD" \
"CC = c89 -D_POSIX_SOURCE" $(MAKE_OPTIONS) \
$(TARGETS)
LINUX-486:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -O -D_BSD -m486" \
$(MAKE_OPTIONS) $(TARGETS)
# MIPS RC6280 (and other models) RISCos 2.1.1AC (and EP/IX)
MIPS-MIPS:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) -DLARGE_MACHINE -O -D_BSD -Olimit 1000 -systype bsd43" \
$(MAKE_OPTIONS) $(TARGETS)
# SGI target improved by Mark Hanning-Lee of JPL. Use -O2 for full
# optimization. 4.0.x users can even use -O3, but 5.2 complains about
# using -O3 with the -c option.
# Warning: do not split this quoted string across a line boundary; SGI
# IRIX 4.0.x make incorrectly preserves the newline, causing
# compilation commands to fail. Irix 5.x make handles the newline OK.
SGIFLAGS="CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -DVMS_IO -DVMS_TAB -O2 -D_BSD"
SGI:
$(MAKE) $(SGIFLAGS) $(MAKE_OPTIONS) $(TARGETS)
# IRIX uses pre-formatted, packed man pages and nroff is not bundled with it.
# Only execute this target if your IRIX has nroff.
SGI-INSTALL: install-exe install-man-sgi
install-man-sgi:
$(NROFF) -man dcl2inc.man > dcl2inc.cat ; \
if pack dcl2inc.cat ; \
then \
$(MV) dcl2inc.cat.z $(MANDIR)/dcl2inc.z ; \
$(CHMOD) 644 $(MANDIR)/dcl2inc.z ; \
fi
$(NROFF) -man ftnchek.man > ftnchek.cat ; \
if pack ftnchek.cat ; \
then \
$(MV) ftnchek.cat.z $(MANDIR)/ftnchek.z ; \
$(CHMOD) 644 $(MANDIR)/ftnchek.z ; \
fi
-$(RM) $(MANDIR)/fcl2vcg.z
SOLARIS2.x SUNOS5.x:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -xO4 -D_BSD" \
$(MAKE_OPTIONS) $(TARGETS)
SOLARIS2.x-gcc SUNOS5.x-gcc:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -O2 -D_BSD" \
$(MAKE_OPTIONS) CC=gcc $(TARGETS)
SOLARIS2.x-apcc SUNOS5.x-apcc:
$(MAKE) "CFLAGS= -DUNIX -DLARGE_MACHINE $(OPTIONS) -O5 -D_BSD" \
$(MAKE_OPTIONS) CC=apcc $(TARGETS)
SUNOS4.0:
$(MAKE) \
"CFLAGS= -DUNIX -DLARGE_MACHINE -DNO_PROTOTYPES $(OPTIONS) -O -D_BSD" \
$(MAKE_OPTIONS) $(TARGETS)
# NB: ftnchek 2.8 fails with -O4 on SunOS 4.1.3, but -O3 is okay
# The failure occurs from bad code generation for forlex.c with cc
# version RELEASE SC1.0 1Mar1991 (from "showrev cc").
SUNOS4.1:
$(MAKE) \
"CFLAGS= -DUNIX -DLARGE_MACHINE -DNO_PROTOTYPES $(OPTIONS) -O3 -D_BSD" \
$(MAKE_OPTIONS) $(TARGETS)
ULTRIX-MIPS:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) -DLARGE_MACHINE -Olimit 2000 -O -D_BSD"\
$(MAKE_OPTIONS) $(TARGETS)