forked from emmt/Algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (38 loc) · 1.13 KB
/
Makefile
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
F2CFLAGS = -Aas
F2CLIBS = -lf2c
CC = gcc
CPPFLAGS = -I.
CFLAGS = -Wall -O2
F2CSOURCES = addcon.c adjtol.c conres.c delcon.c eqcons.c fgcalc.c getd.c \
getfes.c getmin.c initzu.c ktvec.c lsrch.c main.c minflc.c \
minfun.c newcon.c satact.c sdegen.c sdirn.c stepbd.c zbfgs.c
F2COBJECTS = $(F2CSOURCES:.c=.o)
# The following filter command can be used to convert scientific exponential
# notation for floating-point number from C to FORTRAN. Just use `cat` if
# no conversion is needed.
#
# FILTER = sed 's/\([0-9]\)[eE]\([-+]\?[0-9]\)/\1D\2/g;s/GETMIN/TOLMIN/g'
FILTER = cat
default:
echo $(F2COBJECTS)
%.c: ../fortran/%.f
f2c $(F2CFLAGS) $<
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
tolmin-f2c: $(F2COBJECTS)
$(CC) $^ -o $@ $(F2CLIBS) -lm
tolmin.o: tolmin.c tolmin.h
tolmin-test.o: tolmin-test.c tolmin.h
tolmin-test: tolmin-test.o tolmin.o
$(CC) $^ -o $@ -lm
tolmin-wrap.o: tolmin-wrap.c tolmin.h
output.txt: tolmin-test
./$< | $(FILTER) >$@
output-f2c.txt: tolmin-f2c
./$< | $(FILTER) >$@
test: output.txt
diff output-orig.txt $<
clean:
$(RM) *~ *.o
veryclean: clean
$(RM) $(F2CSOURCES) tolmin-test