source: trunk/fsource/Makefile @ 201

Last change on this file since 201 was 201, checked in by vondreele, 12 years ago
File size: 4.7 KB
Line 
1# build the compiled fortran codes needed by GSAS-II
2
3BIN = ..\\bin
4LIBS = $(BIN)/pack_f.$(SUFFIX) $(BIN)/pyspg.$(SUFFIX) $(BIN)/polymask.$(SUFFIX) $(BIN)/histogram2d.$(SUFFIX) $(BIN)/pypowder.$(SUFFIX)
5SYMLIB := $(wildcard spsubs/*.for)
6POWLIB := $(wildcard powsubs/*.for)
7MACFIX = #
8MACCOPY = #
9#----------------------------------------------------------------------
10# linux (gfortran)
11#GSASlib = ./libgsas.a
12#COMPILER=--fcompiler=gnu95
13#PACKCOPTS=--f77flags="-fno-range-check"
14#SUFFIX=so
15#F2PY=f2py
16#MOVE=mv
17#DEL= \#
18#----------------------------------------------------------------------
19# mac (gfortran)
20#GSASlib = /Users/toby/software/work/gsas/2009Aug31/libgsas.a
21#COMPILER=--fcompiler=gnu95 --f90exec=/usr/local/bin/gfortran
22#PACKCOPTS=--f77flags="-fno-range-check"
23#SUFFIX=so
24#F2PY=f2py
25#MOVE=mv
26#DEL=\#
27#MACFIX = install_name_tool -change
28#MACCOPY = cp
29#----------------------------------------------------------------------
30# windows g77
31#COMPILER=--fcompiler=gnu
32#PACKCOPTS=--f77flags="-fno-range-check"
33#SUFFIX=pyd
34#F2PY=f2py
35#MOVE=copy
36#DEL=del
37#----------------------------------------------------------------------
38# Windows gfortran-32
39COMPILER=--compiler=mingw32
40PACKCOPTS=--f77flags="-fno-range-check"
41SUFFIX=pyd
42F2PY=f2py
43MOVE=copy
44DEL=del
45
46
47
48
49ask: 
50        @echo ""
51        @echo "Use make all or choose a target: "
52        @echo " $(LIBS) "
53
54all:: $(BIN) $(LIBS)
55
56# OSX: note that this is building .so's that require libgfortran and
57# libgcc_s.1 at runtime. Based on advice from Ilan at EPD, the .so files are
58# modified so that the libraries are placed in the same location as the .so files
59# Use otool -L <file.so> to see what is required
60#
61$(BIN)::
62        -mkdir $(BIN)
63
64$(BIN)/pack_f.$(SUFFIX): pack_f.for $(BIN)
65        $(F2PY) -c pack_f.for -m pack_f $(COMPILER) $(PACKCOPTS)
66#       $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib pack_f.$(SUFFIX)
67#       $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
68#       $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib pack_f.$(SUFFIX)
69#       $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
70        $(MOVE) pack_f.$(SUFFIX) $(BIN)
71        $(DEL) pack_f.$(SUFFIX)
72
73$(BIN)/pypowder.$(SUFFIX): pypowder.for $(POWLIB) $(BIN)
74        $(F2PY) -c pypowder.for -m pypowder $(COMPILER) $(POWLIB)
75#       $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib pypowder.$(SUFFIX)
76#       $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
77#       $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib pypowder.$(SUFFIX)
78#       $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
79        $(MOVE) pypowder.$(SUFFIX) $(BIN)
80        $(DEL) pypowder.$(SUFFIX)
81
82$(BIN)/pyspg.$(SUFFIX): pyspg.for $(SYMLIB) $(BIN)
83        $(F2PY) -c pyspg.for $(SYMLIB) -m pyspg $(COMPILER)
84#       $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib pyspg.$(SUFFIX)
85#       $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
86#       $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib pyspg.$(SUFFIX)
87#       $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
88        $(MOVE) pyspg.$(SUFFIX) $(BIN)
89        $(DEL) pyspg.$(SUFFIX)
90
91$(BIN)/polymask.$(SUFFIX): polymask.for $(SYMLIB) $(BIN)
92        $(F2PY) -c polymask.for -m polymask $(COMPILER)
93#       $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib polymask.$(SUFFIX)
94#       $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
95#       $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib polymask.$(SUFFIX)
96#       $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
97        $(MOVE) polymask.$(SUFFIX) $(BIN)
98        $(DEL) polymask.$(SUFFIX)
99
100$(BIN)/histogram2d.$(SUFFIX): histogram2d.for $(SYMLIB) $(BIN)
101        $(F2PY) -c histogram2d.for -m histogram2d $(COMPILER)
102#       $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib histogram2d.$(SUFFIX)
103#       $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
104#       $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib histogram2d.$(SUFFIX)
105#       $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
106        $(MOVE) histogram2d.$(SUFFIX) $(BIN)
107        $(DEL) histogram2d.$(SUFFIX)
108
109
110# basic outline for build; change ????? and add any specific options to F2PY step
111# $(BIN)/?????.$(SUFFIX): ?????.for $(SYMLIB) $(BIN)
112#       $(F2PY) -c ?????.for -m ????? $(COMPILER)
113#       $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib ?????.$(SUFFIX)
114#       $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
115#       $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib ?????.$(SUFFIX)
116#       $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
117#       $(MOVE) ?????.$(SUFFIX) $(BIN)
118#       $(DEL) ?????.$(SUFFIX)
119
120
121# no longer in use
122#$(BIN)/fitellipse.$(SUFFIX): fitellipse.for
123#       cd $(BIN); $(F2PY) -c ../fitellipse.for -m fitellipse --fcompiler=gfortran --f90exec=/usr/local/bin/gfortran --f77flags="-fno-range-check"
124
125
Note: See TracBrowser for help on using the repository browser.