1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
|
#=======================================================================
# 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 smaller than defaults uncomment this:
#OPTIONS = -DMEDIUM_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: config.h ftnchek.h
exprtype.o: config.h ftnchek.h symtab.h tokdefs.h
forlex.o: config.h ftnchek.h keywords.h symtab.h tokdefs.h
fortran.o: config.h ftnchek.h symtab.h fortran.c
pgsymtab.o: config.h ftnchek.h symtab.h
plsymtab.o: config.h ftnchek.h symtab.h
project.o: config.h ftnchek.h symtab.h
symtab.o: config.h 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 $(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) -O' \
$(MAKE_OPTIONS) $(TARGETS)
coff2exe ftnchek
del ftnchek
GENERIC LINUX STARDENT UNIX:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) -O -D_BSD" \
$(MAKE_OPTIONS) $(TARGETS)
# Add compiler flag to eliminate optimizer table overflow
HP:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) -O -D_BSD +Obb700" \
$(MAKE_OPTIONS) $(TARGETS)
IBM-RS6000:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) \
-DAIXC -DRAND_NO_ARG -O -D_BSD" \
"CC = c89 -D_POSIX_SOURCE" $(MAKE_OPTIONS) \
$(TARGETS)
LINUX-486:
$(MAKE) "CFLAGS= -DUNIX $(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) -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 $(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 $(OPTIONS) -xO4 -D_BSD" \
$(MAKE_OPTIONS) $(TARGETS)
SOLARIS2.x-gcc SUNOS5.x-gcc:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) -O2 -D_BSD" \
$(MAKE_OPTIONS) CC=gcc $(TARGETS)
SOLARIS2.x-apcc SUNOS5.x-apcc:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) -O5 -D_BSD" \
$(MAKE_OPTIONS) CC=apcc $(TARGETS)
SUNOS4.0:
$(MAKE) \
"CFLAGS= -DUNIX -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 -DNO_PROTOTYPES $(OPTIONS) -O3 -D_BSD" \
$(MAKE_OPTIONS) $(TARGETS)
ULTRIX-MIPS:
$(MAKE) "CFLAGS= -DUNIX $(OPTIONS) -Olimit 2000 -O -D_BSD"\
$(MAKE_OPTIONS) $(TARGETS)
|