source: trunk/fsource/Makefile @ 253

Last change on this file since 253 was 253, checked in by toby, 11 years ago

fix mouse labeling; makefile cleaning (not done)

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