delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/11/02/19:24:32

Date: Tue, 2 Nov 93 18:38:35 EST
From: lupoja AT feynman DOT ml DOT wpafb DOT af DOT mil (Jim Lupo)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Compiling f2c with djgpp
Cc: itano AT enh DOT nist DOT gov

You need to make a couple of minor changes.

In f2c/libf77/s_paus.c, change the definition of pause as
follows:

	...
	extern int getpid(void), isatty(int);
	#ifndef __GO32__
	extern int pause(void);
	#endif
	...

In f2c/libi77/rawio.h, add the following three lines to the beginning
of the file:

	#ifdef __GO32__
	#undef MSDOS
	#endif
	...

Then change the declarations of read and write as follows:

	...
	extern int close(int);
	#ifndef __GO32__
	extern int read(int,void*,size_t), write(int,void*,size_t);
	#endif
	...

I use ndmake, so the makefiles must be modified to handle the
character limit on the command line under MS-DOS.  I've also
chosen to make one library, libf2c.a.  I execute then with

	cd libf77
	ndmake -f makefile.djg
	cd ..\libi77
	ndmake -f makefile.djg

Copies of these makefiles are tacked onto the end.  I've also tacked
on my makefile for f2c/src.  You need bison for the way its currently
set up.  You may have to fiddle a bit if xsum gives you problems.
Also, make sure the CFLAGS option -m486 is appropriate for your
machine.

Jim
    ------------------- Optional Methods -----------------------
ATTN: Dr James A. Lupo                    COMM:  (513) 255-6671, Ext 3160
WL/MPLJ Bldg 651                          DSN:         785-6671, Ext 3160
3005 P St Ste 1                           FAX:           5-1128
Wright-Patterson AFB OH 45433-7702        lupoja AT feynman DOT ml DOT wpafb DOT af DOT mil
                                                 (134.131.35.31)

Makefiles follow:

********************* makefile.djg for libf77 *********************

.SUFFIXES: .c .o
CC = gcc
CFLAGS = -g -O -I.. -m486

# compile, then strip unnecessary symbols
.c.o:
	$(CC) -c -DSkip_f2c_Undefs $(CFLAGS) $*.c
	ld -r -x -o $*.xxx $*.o
	mv $*.xxx $*.o

MISC1 =	Version.o main.o s_rnge.o abort_.o getarg_.o iargc_.o getenv_.o
MISC2 =	signal_.o s_stop.o s_paus.o system_.o cabs.o derf_.o derfc_.o
MISC3 = erf_.o erfc_.o sig_die.o
POW = pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o  pow_ri.o pow_zi.o pow_zz.o
CX = c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o
DCX = z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o
REAL1 = r_abs.o r_acos.o r_asin.o r_atan.o r_atn2.o r_cnjg.o r_cos.o r_cosh.o
REAL2 = r_dim.o r_exp.o r_imag.o r_int.o r_lg10.o r_log.o r_mod.o r_nint.o 
REAL3 = r_sign.o r_sin.o r_sinh.o r_sqrt.o r_tan.o r_tanh.o
DBL1 = d_abs.o d_acos.o d_asin.o d_atan.o d_atn2.o d_cnjg.o d_cos.o d_cosh.o
DBL2 = d_dim.o d_exp.o d_imag.o d_int.o d_lg10.o d_log.o d_mod.o d_nint.o
DBL3 = d_prod.o d_sign.o d_sin.o d_sinh.o d_sqrt.o d_tan.o d_tanh.o
INT = i_abs.o i_dim.o i_dnnt.o i_indx.o i_len.o i_mod.o i_nint.o i_sign.o
HALF = h_abs.o h_dim.o h_dnnt.o h_indx.o h_len.o h_mod.o  h_nint.o h_sign.o
CMP = l_ge.o l_gt.o l_le.o l_lt.o hl_ge.o hl_gt.o hl_le.o hl_lt.o
EFL = ef1asc_.o ef1cmc_.o
CHAR = s_cat.o s_cmp.o s_copy.o

libF77.a : $(MISC1) $(MISC2) $(MISC3) $(POW) $(CX) $(DCX) $(REAL1) $(REAL2) \
	$(REAL3) $(DBL1) $(DBL2) $(DBL3) $(INT) $(HALF) $(CMP) $(EFL) $(CHAR)
	rm -f libF77.a
	ar r libF77.a $(MISC1)
	ar r ../libf2c.a $(MISC1)
	ar r libF77.a $(MISC2)
	ar r ../libf2c.a $(MISC2)
	ar r libF77.a $(MISC3)
	ar r ../libf2c.a $(MISC3)
	ar r libF77.a $(POW)
	ar r ../libf2c.a $(POW)
	ar r libF77.a $(CX)
	ar r ../libf2c.a $(CX)
	ar r libF77.a $(DCX)
	ar r ../libf2c.a $(DCX)
	ar r libF77.a $(REAL1)
	ar r ../libf2c.a $(REAL1)
	ar r libF77.a $(REAL2)
	ar r ../libf2c.a $(REAL2)
	ar r libF77.a $(REAL3)
	ar r ../libf2c.a $(REAL3)
	ar r libF77.a $(DBL1)
	ar r ../libf2c.a $(DBL1)
	ar r libF77.a $(DBL2)
	ar r ../libf2c.a $(DBL2)
	ar r libF77.a $(DBL3)
	ar r ../libf2c.a $(DBL3)
	ar r libF77.a $(INT)
	ar r ../libf2c.a $(INT)
	ar r libF77.a $(HALF)
	ar r ../libf2c.a $(HALF)
	ar r libF77.a $(CMP)
	ar r ../libf2c.a $(CMP)
	ar r libF77.a $(EFL)
	ar r ../libf2c.a $(EFL)
	ar r libF77.a $(CHAR)
	ar r ../libf2c.a $(CHAR)
	ranlib libF77.a

Version.o: Version.c
	$(CC) $(CFLAGS) -c Version.c

# To compile with C++, first "make f2c.h"
f2c.h: f2ch.add
	cat /usr/include/f2c.h f2ch.add >f2c.h

# If your system lacks onexit() and you are not using an
# ANSI C compiler, then you should uncomment the following
# two lines (for compiling main.o):
#main.o: main.c
#	$(CC) $(CFLAGS) -c -DNO_ONEXIT -DSkip_f2c_Undefs main.c
# On at least some Sun systems, it is more appropriate to
# uncomment the following two lines:
main.o: main.c
	$(CC) $(CFLAGS) -c -DNO_ONEXIT -Donexit=on_exit main.c

install:	libF77.a
	mv libF77.a /usr/lib

clean:
	rm -f libF77.a *.o

check:
	xsum Notice README Version.c abort_.c c_abs.c c_cos.c c_div.c \
	c_exp.c c_log.c c_sin.c c_sqrt.c cabs.c d_abs.c d_acos.c \
	d_asin.c d_atan.c d_atn2.c d_cnjg.c d_cos.c d_cosh.c d_dim.c \
	d_exp.c d_imag.c d_int.c d_lg10.c d_log.c d_mod.c d_nint.c \
	d_prod.c d_sign.c d_sin.c d_sinh.c d_sqrt.c d_tan.c d_tanh.c \
	derf_.c derfc_.c ef1asc_.c ef1cmc_.c erf_.c erfc_.c f2ch.add \
	getarg_.c getenv_.c h_abs.c h_dim.c h_dnnt.c h_indx.c h_len.c \
	h_mod.c h_nint.c h_sign.c hl_ge.c hl_gt.c hl_le.c hl_lt.c \
	i_abs.c i_dim.c i_dnnt.c i_indx.c i_len.c i_mod.c i_nint.c \
	i_sign.c iargc_.c l_ge.c l_gt.c l_le.c l_lt.c main.c makefile \
	pow_ci.c pow_dd.c pow_di.c pow_hh.c pow_ii.c pow_qq.c pow_ri.c \
	pow_zi.c pow_zz.c r_abs.c r_acos.c r_asin.c r_atan.c r_atn2.c \
	r_cnjg.c r_cos.c r_cosh.c r_dim.c r_exp.c r_imag.c r_int.c r_lg10.c \
	r_log.c r_mod.c r_nint.c r_sign.c r_sin.c r_sinh.c r_sqrt.c \
	r_tan.c r_tanh.c s_cat.c s_cmp.c s_copy.c s_paus.c s_rnge.c \
	s_stop.c sig_die.c signal_.c system_.c z_abs.c z_cos.c z_div.c \
	z_exp.c z_log.c z_sin.c z_sqrt.c >zap
	cmp zap libF77.xsum && rm zap || diff libF77.xsum zap


********************  makefile.djg for libi77 ********************

.SUFFIXES: .c .o
CC = gcc
CFLAGS = -g -I.. -O -m486

# compile, then strip unnecessary symbols
.c.o:
	$(CC) -c $(CFLAGS) $*.c
	ld -r -x -o $*.xxx $*.o
	mv $*.xxx $*.o

OBJ1 = Version.o backspace.o close.o dfe.o dolio.o due.o endfile.o err.o
OBJ2 = fmt.o fmtlib.o iio.o ilnw.o inquire.o lread.o lwrite.o open.o
OBJ3 = rdfmt.o rewind.o rsfe.o rsli.o rsne.o sfe.o sue.o typesize.o uio.o
OBJ4 = util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o

libI77.a: $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4)
	rm -f libI77.a
	ar r libI77.a $(OBJ1)
	ar r ../libf2c.a $(OBJ1)
	ar r libI77.a $(OBJ2)
	ar r ../libf2c.a $(OBJ2)
	ar r libI77.a $(OBJ3)
	ar r ../libf2c.a $(OBJ3)
	ar r libI77.a $(OBJ4)
	ar r ../libf2c.a $(OBJ4)
	ranlib libI77.a

install: libI77.a
	cp libI77.a /usr/lib/libI77.a
	ranlib /usr/lib/libI77.a

Version.o: Version.c
	$(CC) -c Version.c

# To compile with C++, first "make f2c.h"
f2c.h: f2ch.add
	cat /usr/include/f2c.h f2ch.add >f2c.h

clean:
	rm -f *.o

clobber:	clean
	rm -f libI77.a

backspace.o:	fio.h
close.o:	fio.h
dfe.o:		fio.h
dfe.o:		fmt.h
due.o:		fio.h
endfile.o:	fio.h rawio.h
err.o:		fio.h rawio.h
fmt.o:		fio.h
fmt.o:		fmt.h
iio.o:		fio.h
iio.o:		fmt.h
ilnw.o:		fio.h
ilnw.o:		lio.h
inquire.o:	fio.h
lread.o:	fio.h
lread.o:	fmt.h
lread.o:	lio.h
lread.o:	fp.h
lwrite.o:	fio.h
lwrite.o:	fmt.h
lwrite.o:	lio.h
open.o:		fio.h rawio.h
rdfmt.o:	fio.h
rdfmt.o:	fmt.h
rdfmt.o:	fp.h
rewind.o:	fio.h
rsfe.o:		fio.h
rsfe.o:		fmt.h
rsli.o:		fio.h
rsli.o:		lio.h
rsne.o:		fio.h
rsne.o:		lio.h
sfe.o:		fio.h
sue.o:		fio.h
uio.o:		fio.h
util.o:		fio.h
wref.o:		fio.h
wref.o:		fmt.h
wref.o:		fp.h
wrtfmt.o:	fio.h
wrtfmt.o:	fmt.h
wsfe.o:		fio.h
wsfe.o:		fmt.h
wsle.o:		fio.h
wsle.o:		fmt.h
wsle.o:		lio.h
wsne.o:		fio.h
wsne.o:		lio.h
xwsne.o:	fio.h
xwsne.o:	lio.h
xwsne.o:	fmt.h

check:
	xsum Notice README Version.c backspace.c close.c dfe.c dolio.c \
	due.c endfile.c err.c f2ch.add fio.h fmt.c fmt.h fmtlib.c fp.h \
	iio.c ilnw.c inquire.c lio.h lread.c lwrite.c makefile open.c \
	rawio.h rdfmt.c rewind.c rsfe.c rsli.c rsne.c sfe.c sue.c \
	typesize.c uio.c util.c wref.c wrtfmt.c wsfe.c wsle.c wsne.c \
	xwsne.c >zap
	cmp zap libI77.xsum && rm zap || diff libI77.xsum zap


********************  makefile.djg for f2c  ********************

#	Makefile for f2c, a Fortran 77 to C converter

CC = gcc
CFLAGS = -g -O -m486
YACC = bison -y

OBJ1 = main.o init.o gram.o lex.o proc.o equiv.o data.o format.o
OBJ2 = expr.o exec.o intr.o io.o misc.o error.o mem.o names.o
OBJ3 = output.o p1output.o pread.o put.o putpcc.o vax.o formatdata.o
OBJ4 = parse_args.o niceprintf.o cds.o sysdep.o version.o

all: xsum.out f2c

f2c: $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4)
	echo $(OBJ1) > obj.tmp
	echo $(OBJ2) >> obj.tmp
	echo $(OBJ3) >> obj.tmp
	echo $(OBJ4) >> obj.tmp
	$(CC) @obj.tmp -o f2c
	rm obj.tmp
	aout2exe f2c

$(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4): defs.h ftypes.h defines.h machdefs.h sysdep.h

gram.o:	gram.c
	$(CC) $(CFLAGS) -c gram.c

gram.c: gram.head gram.dcl gram.expr gram.exec gram.io tokdefs.h defs.h \
	p1defs.h
	sed < tokdefs.h "s/#define/%token/" > gram.in
	cat gram.head gram.dcl gram.expr gram.exec gram.io >> gram.in
	$(YACC) $(YFLAGS) gram.in
	@echo.
	@echo (4 shift/reduce is normal)
	@echo.
	sed "s/^# line.*/\/* & *\//" y_tab.c > gram.c
	rm -f gram.in y_tab.c

tokdefs.h: tokens
	grep -n . <tokens | sed "s/\([^:]*\):\(.*\)/#define \2 \1/" >tokdefs.h

cds.o: sysdep.h
exec.o: p1defs.h names.h
expr.o: output.h niceprintf.h names.h
format.o: p1defs.h format.h output.h niceprintf.h names.h iob.h
formatdata.o: format.h output.h niceprintf.h names.h
gram.o: p1defs.h
init.o: output.h niceprintf.h iob.h
intr.o: names.h
io.o: names.h iob.h
lex.o : tokdefs.h p1defs.h
main.o: parse.h usignal.h
mem.o: iob.h
names.o: iob.h names.h output.h niceprintf.h
niceprintf.o: defs.h names.h output.h niceprintf.h
output.o: output.h niceprintf.h names.h
p1output.o: p1defs.h output.h niceprintf.h names.h
parse_args.o: parse.h
proc.o: tokdefs.h names.h niceprintf.h output.h p1defs.h
put.o: names.h pccdefs.h p1defs.h
putpcc.o: names.h
vax.o: defs.h output.h pccdefs.h
output.h: niceprintf.h

put.o putpcc.o: pccdefs.h

f2c.t: f2c.1t
	troff -man f2c.1t >f2c.t

f2c.1: f2c.1t
	nroff -man f2c.1t | col -b | uniq >f2c.1

clean:
	rm -f gram.c *.o f2c tokdefs.h xsum.out xsum

clobber:  clean
	rm -f f2c.exe xsum.exe

B1 = Notice README.unx README.djg cds.c data.c defines.h defs.h equiv.c error.c 
B2 = exec.c expr.c f2c.1 f2c.1t f2c.h format.c format.h formatdata.c
B3 = ftypes.h gram.dcl gram.exec gram.expr gram.head gram.io
B4 = init.c intr.c io.c iob.h lex.c machdefs.h main.c makefile.unx makefile.djg
B5 = malloc.c mem.c memset.c misc.c names.c names.h niceprintf.c
B6 = niceprintf.h output.c output.h p1defs.h p1output.c
B7 = parse.h parse_args.c pccdefs.h pread.c proc.c put.c putpcc.c
B8 = sysdep.c sysdep.h tokens usignal.h vax.c version.c xsum.c

xsum.exe: xsum.c
	$(CC) -o xsum xsum.c
	aout2exe xsum

#Check validity of transmitted source...

xsum.out: xsum.exe
	xsum $(B1) > xsum.out
	xsum $(B2) >> xsum.out
	xsum $(B3) >> xsum.out
	xsum $(B4) >> xsum.out
	xsum $(B5) >> xsum.out
	xsum $(B6) >> xsum.out
	xsum $(B7) >> xsum.out
	xsum $(B8) >> xsum.out
	diff xsum0.out xsum.out

Jim
    ------------------- Optional Methods -----------------------
ATTN: Dr James A. Lupo                    COMM:  (513) 255-6671, Ext 3160
WL/MPLJ Bldg 651                          DSN:         785-6671, Ext 3160
3005 P St Ste 1                           FAX:           5-1128
Wright-Patterson AFB OH 45433-7702        lupoja AT feynman DOT ml DOT wpafb DOT af DOT mil
                                                 (134.131.35.31)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019