source: trunk/fsource/Makefile @ 315

Last change on this file since 315 was 315, checked in by toby, 12 years ago

new scons file for compiling (needs linux & win work); update macbin's; changes to texture to work on Mac; minor cleanup to GSASIIpwd

File size: 4.3 KB
Line 
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#
4scons:
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
35BIN = ../bin
36LIBS = $(BIN)/pack_f.$(SUFFIX) $(BIN)/fellipse.$(SUFFIX) $(BIN)/pyspg.$(SUFFIX) $(BIN)/polymask.$(SUFFIX) $(BIN)/histogram2d.$(SUFFIX) $(BIN)/pytexture.$(SUFFIX)
37SYMLIB := $(wildcard spsubs/*.for)
38TXTLIB := $(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)
49COMPILER=--fcompiler=gnu95 --f77exec=/sw/bin/gfortran
50PACKCOPTS=--f77flags="-fno-range-check" # -static-libgfortran -static-libgcc
51SUFFIX=so
52F2PY=f2py
53MOVE=mv
54DEL=\#
55RM=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
76ask: 
77        @echo ""
78        @echo "Use make all or choose a target: "
79        @echo " $(LIBS) "
80
81all:: $(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
127clean:
128        $(RM) $(LIBS)
Note: See TracBrowser for help on using the repository browser.