source: trunk/fsource/Makefile @ 128

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

Linux build opts

File size: 4.8 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)
5LIBSwGSAS = $(BIN)/pypowder.$(SUFFIX)
6SYMLIB := $(wildcard spsubs/*.for)
7MACFIX = \#
8MACCOPY = \#
9#----------------------------------------------------------------------
10# linux (gfortran)
11GSASlib = ./libgsas.a
12COMPILER=--fcompiler=gnu95
13PACKCOPTS=--f77flags="-fno-range-check"
14SUFFIX=so
15F2PY=f2py
16MOVE=mv
17DEL= \#
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.py
35#MOVE=copy
36#DEL=del
37#----------------------------------------------------------------------
38
39ask: 
40        @echo ""
41        @echo "Use make all or choose a target: "
42        @echo " $(LIBS) $(LIBSwGSAS)"
43        @echo "   Note: target $(LIBSwGSAS) requires the GSAS object library."
44        @echo "     File $(LIBSwGSAS) is built from files that are not distributed."
45        @echo "     This is built last with make all. You may need to edit the"
46        @echo "     Makefile to set GSASlib to point to the correct location."
47
48all:: $(BIN) $(LIBS) $(LIBSwGSAS)
49
50# OSX: note that this is building .so's that require libgfortran and
51# libgcc_s.1 at runtime. Based on advice from Ilan at EPD, the .so files are
52# modified so that the libraries are placed in the same location as the .so files
53# Use otool -L <file.so> to see what is required
54#
55$(BIN)::
56        -mkdir $(BIN)
57
58$(BIN)/pack_f.$(SUFFIX): pack_f.for $(BIN)
59        $(F2PY) -c pack_f.for -m pack_f $(COMPILER) $(PACKCOPTS)
60        $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib pack_f.$(SUFFIX)
61        $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
62        $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib pack_f.$(SUFFIX)
63        $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
64        $(MOVE) pack_f.$(SUFFIX) $(BIN)
65        $(DEL) pack_f.$(SUFFIX)
66
67$(BIN)/pypowder.$(SUFFIX): pypowder.for $(GSASlib) $(BIN)
68        $(F2PY) -c pypowder.for -m pypowder $(COMPILER) $(GSASlib)
69        $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib pypowder.$(SUFFIX)
70        $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
71        $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib pypowder.$(SUFFIX)
72        $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
73        $(MOVE) pypowder.$(SUFFIX) $(BIN)
74        $(DEL) pypowder.$(SUFFIX)
75
76$(BIN)/pyspg.$(SUFFIX): pyspg.for $(SYMLIB) $(BIN)
77        $(F2PY) -c pyspg.for $(SYMLIB) -m pyspg $(COMPILER)
78        $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib pyspg.$(SUFFIX)
79        $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
80        $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib pyspg.$(SUFFIX)
81        $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
82        $(MOVE) pyspg.$(SUFFIX) $(BIN)
83        $(DEL) pyspg.$(SUFFIX)
84
85$(BIN)/polymask.$(SUFFIX): polymask.for $(SYMLIB) $(BIN)
86        $(F2PY) -c polymask.for -m polymask $(COMPILER)
87        $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib polymask.$(SUFFIX)
88        $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
89        $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib polymask.$(SUFFIX)
90        $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
91        $(MOVE) polymask.$(SUFFIX) $(BIN)
92        $(DEL) polymask.$(SUFFIX)
93
94$(BIN)/histogram2d.$(SUFFIX): histogram2d.for $(SYMLIB) $(BIN)
95        $(F2PY) -c histogram2d.for -m histogram2d $(COMPILER)
96        $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib histogram2d.$(SUFFIX)
97        $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
98        $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib histogram2d.$(SUFFIX)
99        $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
100        $(MOVE) histogram2d.$(SUFFIX) $(BIN)
101        $(DEL) histogram2d.$(SUFFIX)
102
103
104# basic outline for build; change ????? and add any specific options to F2PY step
105# $(BIN)/?????.$(SUFFIX): ?????.for $(SYMLIB) $(BIN)
106#       $(F2PY) -c ?????.for -m ????? $(COMPILER)
107#       $(MACFIX) /usr/local/lib/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib ?????.$(SUFFIX)
108#       $(MACCOPY) /usr/local/lib/libgcc_s.1.dylib $(BIN)
109#       $(MACFIX) /usr/local/lib/libgfortran.2.dylib @loader_path/libgfortran.2.dylib ?????.$(SUFFIX)
110#       $(MACCOPY) /usr/local/lib/libgfortran.2.dylib $(BIN)
111#       $(MOVE) ?????.$(SUFFIX) $(BIN)
112#       $(DEL) ?????.$(SUFFIX)
113
114
115# no longer in use
116#$(BIN)/fitellipse.$(SUFFIX): fitellipse.for
117#       cd $(BIN); $(F2PY) -c ../fitellipse.for -m fitellipse --fcompiler=gfortran --f90exec=/usr/local/bin/gfortran --f77flags="-fno-range-check"
118
119
Note: See TracBrowser for help on using the repository browser.