1 | # this file is present for historical reasons. The build is now done with scons, which does not need to |
---|
2 | # be configured as source code files are added or removed |
---|
3 | # |
---|
4 | scons: |
---|
5 | scons -Q |
---|
6 | @echo "************************************" |
---|
7 | @echo " Note: build is now done with scons" |
---|
8 | @echo "************************************" |
---|
9 | |
---|
10 | # build the compiled fortran codes needed by GSAS-II with f2py |
---|
11 | # This is a work in progress. The idea is that files built here are placed in |
---|
12 | # the bin directory, which is empty in the svn distribution. If these files will |
---|
13 | # be distributed, they should be moved to a directory named bin<os><ver> where |
---|
14 | # <os> is linux, mac or win and <ver> is the python version |
---|
15 | |
---|
16 | # Note that on the Mac, by default the .so files are not portable because they |
---|
17 | # require libgcc_s.1.dylib and libgfortran.2.dylib to be installed at locations |
---|
18 | # defined by the compiler install. Three solutions are to patch |
---|
19 | # /Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site-packages/numpy/distutils/fcompiler/gnu.py |
---|
20 | #bht3:fcompiler bishop$ diff gnu.py gnu.py.original |
---|
21 | #128,129c128 |
---|
22 | #< opt.extend(['-undefined', 'dynamic_lookup', '-bundle', |
---|
23 | #< '-static-libgfortran','-static-libgcc']) |
---|
24 | #--- |
---|
25 | #> opt.extend(['-undefined', 'dynamic_lookup', '-bundle']) |
---|
26 | |
---|
27 | # or (better) to define the env var |
---|
28 | # export LDFLAGS "-undefined dynamic_lookup -bundle -static-libgfortran -static-libgcc" |
---|
29 | |
---|
30 | # or to edit path in the .so using: |
---|
31 | # install_name_tool -change <path>/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib <file>.so |
---|
32 | # where is <path> is /usr/local/lib |
---|
33 | # On Mac, use otool -L <file.so> to see what libraries are required |
---|
34 | |
---|
35 | BIN = ../bin |
---|
36 | LIBS = $(BIN)/pack_f.$(SUFFIX) $(BIN)/fellipse.$(SUFFIX) $(BIN)/pyspg.$(SUFFIX) $(BIN)/polymask.$(SUFFIX) $(BIN)/histogram2d.$(SUFFIX) $(BIN)/pytexture.$(SUFFIX) |
---|
37 | SYMLIB := $(wildcard spsubs/*.for) |
---|
38 | TXTLIB := $(wildcard texturesubs/*.for) |
---|
39 | #---------------------------------------------------------------------- |
---|
40 | # linux (gfortran) |
---|
41 | #COMPILER=--fcompiler=gnu95 |
---|
42 | #PACKCOPTS=--f77flags="-fno-range-check" |
---|
43 | #SUFFIX=so |
---|
44 | #F2PY=f2py |
---|
45 | #MOVE=mv |
---|
46 | #DEL= \# |
---|
47 | #---------------------------------------------------------------------- |
---|
48 | # mac (gfortran) |
---|
49 | COMPILER=--fcompiler=gnu95 --f77exec=/sw/bin/gfortran |
---|
50 | PACKCOPTS=--f77flags="-fno-range-check" # -static-libgfortran -static-libgcc |
---|
51 | SUFFIX=so |
---|
52 | F2PY=f2py |
---|
53 | MOVE=mv |
---|
54 | DEL=\# |
---|
55 | RM=rm -f |
---|
56 | #---------------------------------------------------------------------- |
---|
57 | # windows g77 |
---|
58 | #COMPILER=--fcompiler=gnu |
---|
59 | #PACKCOPTS=--f77flags="-fno-range-check" |
---|
60 | #SUFFIX=pyd |
---|
61 | #F2PY=f2py |
---|
62 | #MOVE=copy |
---|
63 | #DEL=del |
---|
64 | #---------------------------------------------------------------------- |
---|
65 | # Windows gfortran-32 |
---|
66 | #COMPILER=--compiler=mingw32 |
---|
67 | #PACKCOPTS=--f77flags="-fno-range-check" |
---|
68 | #SUFFIX=pyd |
---|
69 | #F2PY=f2py |
---|
70 | #MOVE=copy |
---|
71 | #DEL=del |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | ask: |
---|
77 | @echo "" |
---|
78 | @echo "Use make all or choose a target: " |
---|
79 | @echo " $(LIBS) " |
---|
80 | |
---|
81 | all:: $(BIN) $(LIBS) |
---|
82 | |
---|
83 | # OSX: note that this is building .so's that require libgfortran and |
---|
84 | # libgcc_s.1 at runtime. Based on advice from Ilan at EPD, the .so files are |
---|
85 | # modified so that the libraries are placed in the same location as the .so files |
---|
86 | # |
---|
87 | $(BIN):: |
---|
88 | -mkdir $(BIN) |
---|
89 | |
---|
90 | $(BIN)/pack_f.$(SUFFIX): pack_f.for |
---|
91 | $(F2PY) -c pack_f.for -m pack_f $(COMPILER) $(PACKCOPTS) |
---|
92 | $(MOVE) pack_f.$(SUFFIX) $(BIN) |
---|
93 | $(DEL) pack_f.$(SUFFIX) |
---|
94 | |
---|
95 | $(BIN)/fellipse.$(SUFFIX): fellipse.for |
---|
96 | $(F2PY) -c fellipse.for -m fellipse $(COMPILER) $(PACKCOPTS) |
---|
97 | $(MOVE) fellipse.$(SUFFIX) $(BIN) |
---|
98 | $(DEL) fellipse.$(SUFFIX) |
---|
99 | |
---|
100 | $(BIN)/polymask.$(SUFFIX): polymask.for |
---|
101 | $(F2PY) -c polymask.for -m polymask $(COMPILER) |
---|
102 | $(MOVE) polymask.$(SUFFIX) $(BIN) |
---|
103 | $(DEL) polymask.$(SUFFIX) |
---|
104 | |
---|
105 | $(BIN)/histogram2d.$(SUFFIX): histogram2d.for |
---|
106 | $(F2PY) -c histogram2d.for -m histogram2d $(COMPILER) |
---|
107 | $(MOVE) histogram2d.$(SUFFIX) $(BIN) |
---|
108 | $(DEL) histogram2d.$(SUFFIX) |
---|
109 | |
---|
110 | $(BIN)/pyspg.$(SUFFIX): pyspg.for $(SYMLIB) |
---|
111 | $(F2PY) -c pyspg.for $(SYMLIB) -m pyspg $(COMPILER) |
---|
112 | $(MOVE) pyspg.$(SUFFIX) $(BIN) |
---|
113 | $(DEL) pyspg.$(SUFFIX) |
---|
114 | |
---|
115 | $(BIN)/pytexture.$(SUFFIX): $(TXTLIB) |
---|
116 | $(F2PY) -c $(TXTLIB) -m pytexture $(COMPILER) |
---|
117 | $(MOVE) pytexture.$(SUFFIX) $(BIN) |
---|
118 | $(DEL) pytexture.$(SUFFIX) |
---|
119 | |
---|
120 | |
---|
121 | # basic outline for build; change ????? and add any specific options to F2PY step |
---|
122 | # $(BIN)/?????.$(SUFFIX): ?????.for $(SYMLIB) $(BIN) |
---|
123 | # $(F2PY) -c ?????.for -m ????? $(COMPILER) |
---|
124 | # $(MOVE) ?????.$(SUFFIX) $(BIN) |
---|
125 | # $(DEL) ?????.$(SUFFIX) |
---|
126 | |
---|
127 | clean: |
---|
128 | $(RM) $(LIBS) |
---|