forked from devernay/cminpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
139 lines (108 loc) · 4.45 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
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
PACKAGE=cminpack
VERSION=1.3.5
CC=gcc
CFLAGS= -O3 -g -Wall -Wextra
### The default configuration is to compile the double precision version
### configuration for the LAPACK/BLAS (double precision) version:
## make LIBSUFFIX= CFLAGS="-O3 -g -Wall -Wextra -D__cminpack_float__"
#LIBSUFFIX=s
#CFLAGS="-O3 -g -Wall -Wextra -DUSE_CBLAS -DUSE_LAPACK"
CFLAGS_L=$(CFLAGS) -DUSE_CBLAS -DUSE_LAPACK
LDADD_L=-framework Accelerate
### configuration for the long double version:
## make LIBSUFFIX=s CFLAGS="-O3 -g -Wall -Wextra -D__cminpack_long_double__"
#LIBSUFFIX=s
#CFLAGS="-O3 -g -Wall -Wextra -D__cminpack_long_double__"
CFLAGS_LD=$(CFLAGS) -D__cminpack_long_double__
### configuration for the float (single precision) version:
## make LIBSUFFIX=s CFLAGS="-O3 -g -Wall -Wextra -D__cminpack_float__"
#LIBSUFFIX=s
#CFLAGS="-O3 -g -Wall -Wextra -D__cminpack_float__"
CFLAGS_F=$(CFLAGS) -D__cminpack_float__
### configuration for the half (half precision) version:
## make LIBSUFFIX=h CFLAGS="-O3 -g -Wall -Wextra -I/opt/local/include -D__cminpack_half__" LDADD="-L/opt/local/lib -lHalf" CC=g++
#LIBSUFFIX=h
#CFLAGS="-O3 -g -Wall -Wextra -I/opt/local/include -D__cminpack_half__"
#LDADD="-L/opt/local/lib -lHalf"
#CC=g++
CFLAGS_H=$(CFLAGS) -I/opt/local/include -D__cminpack_half__
LDADD_H=-L/opt/local/lib -lHalf
CC_H=$(CXX)
OBJS = \
$(LIBSUFFIX)chkder.o $(LIBSUFFIX)enorm.o $(LIBSUFFIX)hybrd1.o $(LIBSUFFIX)hybrj.o \
$(LIBSUFFIX)lmdif1.o $(LIBSUFFIX)lmstr1.o $(LIBSUFFIX)qrfac.o $(LIBSUFFIX)r1updt.o \
$(LIBSUFFIX)dogleg.o $(LIBSUFFIX)fdjac1.o $(LIBSUFFIX)hybrd.o $(LIBSUFFIX)lmder1.o \
$(LIBSUFFIX)lmdif.o $(LIBSUFFIX)lmstr.o $(LIBSUFFIX)qrsolv.o $(LIBSUFFIX)rwupdt.o \
$(LIBSUFFIX)dpmpar.o $(LIBSUFFIX)fdjac2.o $(LIBSUFFIX)hybrj1.o $(LIBSUFFIX)lmder.o \
$(LIBSUFFIX)lmpar.o $(LIBSUFFIX)qform.o $(LIBSUFFIX)r1mpyq.o $(LIBSUFFIX)covar.o $(LIBSUFFIX)covar1.o \
$(LIBSUFFIX)chkder_.o $(LIBSUFFIX)enorm_.o $(LIBSUFFIX)hybrd1_.o $(LIBSUFFIX)hybrj_.o \
$(LIBSUFFIX)lmdif1_.o $(LIBSUFFIX)lmstr1_.o $(LIBSUFFIX)qrfac_.o $(LIBSUFFIX)r1updt_.o \
$(LIBSUFFIX)dogleg_.o $(LIBSUFFIX)fdjac1_.o $(LIBSUFFIX)hybrd_.o $(LIBSUFFIX)lmder1_.o \
$(LIBSUFFIX)lmdif_.o $(LIBSUFFIX)lmstr_.o $(LIBSUFFIX)qrsolv_.o $(LIBSUFFIX)rwupdt_.o \
$(LIBSUFFIX)dpmpar_.o $(LIBSUFFIX)fdjac2_.o $(LIBSUFFIX)hybrj1_.o $(LIBSUFFIX)lmder_.o \
$(LIBSUFFIX)lmpar_.o $(LIBSUFFIX)qform_.o $(LIBSUFFIX)r1mpyq_.o $(LIBSUFFIX)covar_.o
# target dir for install
DESTDIR=/usr/local
#
# Static library target
#
all: libcminpack$(LIBSUFFIX).a
double:
$(MAKE) LIBSUFFIX=
lapack:
$(MAKE) LIBSUFFIX=l CFLAGS="$(CFLAGS_L)" LDADD="$(LDADD_L)"
longdouble:
$(MAKE) LIBSUFFIX=ld CFLAGS="$(CFLAGS_LD)"
float:
$(MAKE) LIBSUFFIX=s CFLAGS="$(CFLAGS_F)"
half:
$(MAKE) LIBSUFFIX=h CFLAGS="$(CFLAGS_H)" LDADD="$(LDADD_H)" CC="$(CC_H)"
fortran:
$(MAKE) -C fortran
cuda:
$(MAKE) -C cuda
check:
$(MAKE) -C examples check
checkdouble:
$(MAKE) -C examples checkdouble
checklapack:
$(MAKE) -C examples checklapack
checklongdouble:
$(MAKE) -C examples checklongdouble
checkfloat:
$(MAKE) -C examples checkfloat
checkhalf:
$(MAKE) -C examples checkhalf
checkfail:
$(MAKE) -C examples checkfail
libcminpack$(LIBSUFFIX).a: $(OBJS)
ar r $@ $(OBJS); ranlib $@
$(LIBSUFFIX)%.o: %.c
${CC} ${CFLAGS} -c -o $@ $<
install: libcminpack$(LIBSUFFIX).a
cp libcminpack$(LIBSUFFIX).a ${DESTDIR}/lib
chmod 644 ${DESTDIR}/lib/libcminpack$(LIBSUFFIX).a
ranlib -t ${DESTDIR}/lib/libcminpack$(LIBSUFFIX).a # might be unnecessary
cp minpack.h ${DESTDIR}/include
chmod 644 ${DESTDIR}/include/minpack.h
cp cminpack.h ${DESTDIR}/include
chmod 644 ${DESTDIR}/include/cminpack.h
clean:
rm -f $(OBJS) libcminpack$(LIBSUFFIX).a
make -C examples clean
make -C fortran clean
veryclean: clean
rm -f *.o libcminpack*.a *.gcno *.gcda *~ #*#
make -C examples veryclean
make -C examples veryclean LIBSUFFIX=s
make -C examples veryclean LIBSUFFIX=h
make -C examples veryclean LIBSUFFIX=l
make -C fortran veryclean
.PHONY: dist all double lapack longdouble float half fortran cuda check checkhalf checkfail clean veryclean
# COPYFILE_DISABLE=true and COPY_EXTENDED_ATTRIBUTES_DISABLE=true are used to disable inclusion
# of file attributes (._* files) in the tar file on MacOSX
dist:
mkdir $(PACKAGE)-$(VERSION)
env COPYFILE_DISABLE=true COPY_EXTENDED_ATTRIBUTES_DISABLE=true tar --exclude-from dist-exclude --exclude $(PACKAGE)-$(VERSION) -cf - . | (cd $(PACKAGE)-$(VERSION); tar xf -)
tar zcvf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
rm -rf $(PACKAGE)-$(VERSION)