Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / lang / f2c / files / f2c.mk
blobf09e5b503bea098e50b3edf8c039b9d7d8d88ff7
1 # Makefile for f2c, a Fortran 77 to C converter
3 PROG= f2c
4 SRCS= main.c init.c gram.c lex.c proc.c equiv.c data.c format.c \
5 expr.c exec.c intr.c io.c misc.c error.c mem.c names.c \
6 output.c p1output.c pread.c put.c putpcc.c vax.c formatdata.c \
7 parse_args.c niceprintf.c cds.c sysdep.c version.c $(MALLOC)
9 F2CSRCDIR= .
10 .PATH: $(F2CSRCDIR)
12 # To use the malloc whose source accompanies the f2c source,
13 # add malloc.c to the right-hand side of the "MALLOC =" line,
14 # so it becomes
15 # MALLOC = malloc.c
16 # This gives faster execution on some systems, but some other
17 # systems do not tolerate replacement of the system's malloc.
18 MALLOC= # empty
20 # In case yacc is broken, a correctly functioning gram.c is distributed
21 # (derived with a Unix variant of the yacc from plan9).
23 # There should be 4 shift/reduce conflicts:
24 .if make(gram.c)
25 gram.y: gram.head gram.dcl gram.expr gram.exec gram.io tokdefs.h
26 ( sed "s/#define/%token/" < $(.ALLSRC:M*tokdefs.h) ; \
27 cat $(.ALLSRC:M*gram.head) \
28 $(.ALLSRC:M*gram.dcl) \
29 $(.ALLSRC:M*gram.expr) \
30 $(.ALLSRC:M*gram.exec) \
31 $(.ALLSRC:M*gram.io) ) > $@
32 CLEANFILES+= gram.y
33 .else
34 gram.c:
35 .endif
37 DPADD= defs.h ftypes.h defines.h machdefs.h sysdep.h
39 CPPFLAGS= -I. # generated files
40 CPPFLAGS+= -I$(F2CSRCDIR) # grammar
42 # tokdefs.h: tokens
43 # grep -n . <tokens | sed "s/\([^:]*\):\(.*\)/#define \2 \1/" >tokdefs.h
45 DPSRCS+= sysdep.hd
47 # Handle obsolete systems like Solaris:
48 sysdep.hd:
49 if $(CC) sysdeptest.c; then echo '/*OK*/' > sysdep.hd; \
50 elif $(CC) -DNO_MKDTEMP sysdeptest.c; then echo '#define NO_MKDTEMP' > sysdep.hd; \
51 else { echo '#define NO_MKDTEMP'; echo '#define NO_MKSTEMP'; } > sysdep.hd; fi
52 rm -f a.out
54 CLEANFILES+= sysdep.hd # sysdep.hd tokdefs.h f2c.t
56 .NOPATH: f2c.1
57 f2c.1: f2c.1t
58 sed -e 's!/usr!${PREFIX}!g' -e 's!lib/libc.a!usr/lib/libc.a!g' $> > $@
60 CLEANFILES+= f2c.1
62 .include "bsd.prog.mk"