-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile_ortep3
54 lines (48 loc) · 1.91 KB
/
Makefile_ortep3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Usage: make -f ../Makefile_ortep3 (in XXXX_build directory)
# Copy source files to ./build/ortep-build and build ortep executable there
#
# Note: make sure that the correct version of gcc/gfortran is found in PATH!
# In the author's environment: (as of 2019/08/15)
# Mac: export PATH=/usr/local/gcc8/bin:$PATH
# Win: enable_brew
ifeq ($(TARGET_PLATFORM),)
ifeq ($(findstring darwin,$(OSTYPE)),darwin)
export TARGET_PLATFORM=MAC
else
export TARGET_PLATFORM=MSW
endif
endif
ifeq ($(TARGET_PLATFORM),MAC)
FFLAGS=-std=legacy -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch x86_64
LIBQUADMATH=/usr/local/gcc8/lib/libquadmath.a
# FLDFLAGS= -nodefaultlibs -lgfortran-static -lgcc -lc -lm -lSystem -lSystemStubs -lgfortranbegin
# FSTATICFLAGS= -static-libgcc -Wl,-Bstatic -lgfortran -lquadmath -Wl,-Bdynamic -lm
FSTATICFLAGS= -static-libgfortran -static-libgcc $(LIBQUADMATH)
FLDFLAGS= -lgcc -lc -lm -lSystem $(FSTATICFLAGS)
EXE_SUFFIX=
FORTRAN=gfortran
else
ifeq ($(TARGET_ARCH),x86_64)
CROSS_PREFIX=x86_64-w64-mingw32-
else
CROSS_PREFIX=i686-w64-mingw32-
endif
FFLAGS=-std=legacy
FSTATICFLAGS= -static-libgcc -Wl,-Bstatic -lgfortran -lquadmath -lpthread -Wl,-Bdynamic -lm
FLDFLAGS=-Wl,--stack=33554432 $(FSTATICFLAGS)
EXE_SUFFIX=.exe
FORTRAN = gcc
endif
export FFLAGS
export FLDFLAGS
OPWD = $(PWD)
TEPDIR = $(OPWD)/../ortep3
BUILDDIR = build/ortep-build
TEPNAME = ortep3_modified
ortep3/ortep3$(EXE_SUFFIX) : $(BUILDDIR)/ortep3$(EXE_SUFFIX)
(mkdir -p ortep3; cp -p $(BUILDDIR)/ortep3$(EXE_SUFFIX) ortep3)
$(BUILDDIR)/ortep3$(EXE_SUFFIX) : $(TEPDIR)/$(TEPNAME).f
(mkdir -p $(OPWD)/$(BUILDDIR); cp -p $(TEPDIR)/$(TEPNAME).f $(OPWD)/$(BUILDDIR)/)
(cd $(OPWD)/$(BUILDDIR) && $(CROSS_PREFIX)$(FORTRAN) $(FFLAGS) -fno-automatic -O -w -c $(TEPNAME).f && $(CROSS_PREFIX)$(FORTRAN) -o ortep3$(EXE_SUFFIX) $(TEPNAME).o $(FFLAGS) $(FLDFLAGS) -O -w)
clean :
rm -rf $(BUILDDIR)