Changeset 127


Ignore:
Timestamp:
Jul 22, 2010 5:53:14 PM (11 years ago)
Author:
toby
Message:

make more portable Mac images

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/fsource/Makefile

    r102 r127  
    11# build the compiled fortran codes needed by GSAS-II
    22
    3 BIN = bin
    4 LIBS = $(BIN)/pack_f.$(SUFFIX) $(BIN)/pyspg.$(SUFFIX)
     3BIN = ../bin
     4LIBS = $(BIN)/pack_f.$(SUFFIX) $(BIN)/pyspg.$(SUFFIX) $(BIN)/polymask.$(SUFFIX) $(BIN)/histogram2d.$(SUFFIX)
    55LIBSwGSAS = $(BIN)/pypowder.$(SUFFIX)
    66SYMLIB := $(wildcard spsubs/*.for)
     7MACFIX = \#
     8MACCOPY = \#
    79#----------------------------------------------------------------------
    810# linux (gfortran)
     11#GSASlib = ./libgsas.a
    912#COMPILER=--fcompiler=gnu95
    1013#PACKCOPTS=--f77flags="-fno-range-check"
     
    1720GSASlib = /Users/toby/software/work/gsas/2009Aug31/libgsas.a
    1821COMPILER=--fcompiler=gnu95 --f90exec=/usr/local/bin/gfortran
    19 #PACKCOPTS=--f77flags="-fno-range-check -static-libgcc"
     22PACKCOPTS=--f77flags="-fno-range-check"
    2023SUFFIX=so
    2124F2PY=f2py
    2225MOVE=mv
    23 DEL=echo
     26DEL=\#
     27MACFIX = install_name_tool -change
     28MACCOPY = cp
    2429#----------------------------------------------------------------------
    2530# windows g77
     
    3742        @echo " $(LIBS) $(LIBSwGSAS)"
    3843        @echo "   Note: target $(LIBSwGSAS) requires the GSAS object library."
    39         @echo "     This is not built with make all. You will need to edit the"
     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"
    4046        @echo "     Makefile to set GSASlib to point to the correct location."
    4147
    42 all:: $(BIN) $(LIBS)
     48all:: $(BIN) $(LIBS) $(LIBSwGSAS)
    4349
    4450# OSX: note that this is building .so's that require libgfortran and
    45 # libgcc_s.1 at runtime. The former can be removed by renaming the accessed
    46 # libgfortran.3.dynlib. Not sure how to avoid libgcc_s.1
     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
    4753# Use otool -L <file.so> to see what is required
    4854#
     
    5258$(BIN)/pack_f.$(SUFFIX): pack_f.for
    5359        $(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)
    5464        $(MOVE) pack_f.$(SUFFIX) $(BIN)
    5565        $(DEL) pack_f.$(SUFFIX)
     
    5767$(BIN)/pypowder.$(SUFFIX): pypowder.for $(GSASlib)
    5868        $(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)
    5973        $(MOVE) pypowder.$(SUFFIX) $(BIN)
    6074        $(DEL) pypowder.$(SUFFIX)
    6175
    6276$(BIN)/pyspg.$(SUFFIX): pyspg.for $(SYMLIB)
    63         $(F2PY) -c pyspg.for $(SYMLIB) -m pyspg $(COMPILER)
     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)
    6482        $(MOVE) pyspg.$(SUFFIX) $(BIN)
    6583        $(DEL) pyspg.$(SUFFIX)
     84
     85$(BIN)/polymask.$(SUFFIX): polymask.for $(SYMLIB)
     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)
     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)
     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
    66114
    67115# no longer in use
Note: See TracChangeset for help on using the changeset viewer.