-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_graetz_problem
175 lines (135 loc) · 5.37 KB
/
make_graetz_problem
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
SHELL=/bin/sh
#***************************************************************************
# Note: Comments start with #.
# $(FOOBAR) means: evaluate the variable defined by FOOBAR= (something).
#
# This file contains a set of rules used by the "make" command.
#
# This makefile $(MAKEFILE) tells "make" how the executable $(COMMAND)
# should be created from the source fileS $(SRCS) and the header files
# $(HDRS) via the object file $(OBJS);
#
# To use this makefile, type the command:
#
# "make -f make_program"
#
# where make_program should be replaced by the name of the makefile.
#
#****************************************************************************
#
# Programmer: Dick Furnstahl ([email protected])
# Edit: Zach Cotman ([email protected])
#
# Latest revision: December 2018
#
# Notes:
# * If you are ok with the default options for compiling and linking, you
# only need to change the entries in section 1.
#
# * Defining BASE determines the name for the makefile (prepend "make_"),
# executable (append ".x"),
# zip archive (append ".zip")
# gzipped tar file (append ".tar.gz").
#
# * To remove the executable and object files, type the command:
#
# "make -f $(MAKEFILE) clean"
#
# * To create a zip archive with name $(BASE).zip containing this
# makefile and the SRCS and HDRS files, type the command:
#
# "make -f $(MAKEFILE) zip"
#
# * To create a gzipped tar file with name $(BASE).tar.gz containing this
# makefile and the source and header files, type the command:
#
# "make -f $(MAKEFILE) tarz"
#
# NOTE:
# Continuation lines are indicated by \ with no space after it.
# If you get a "missing separator" error, it is probably because there
# is a space after a \ somewhere!!!
#
###########################################################################
# SECTION 1: Specify base name, source files, header files, input files
###########################################################################
# ******************** Base Name ***********************
BASE= graetz_problem
# ****************** Source Files **********************
# Put all C++ (or other) source files here.
SRCS= \
graetz_problem.cpp
# ****************** Header Files **********************
HDRS= \
input_parameters.h
# ****************** Input Files ***********************
# Put any input files you want to be saved in tarballs (e.g., sample files).
INPFILE= \
###########################################################################
# SECTION 2: Generate names for object files, makefile, command to execute, tar file
###########################################################################
# *** YOU should not edit these lines unless to change naming conventions ***
OBJS= $(addsuffix .o, $(basename $(SRCS)))
MAKEFILE= make_$(BASE)
COMMAND= $(BASE).x
TARFILE= $(BASE).tar.gz
ZIPFILE= $(BASE).zip
###########################################################################
# SECTION 3. Commands and options for different compilers
###########################################################################
# Compiler parameters
#
# CXX Name of the C++ compiler to use
# CFLAGS Flags to the C++ compiler
# CWARNS Warning options for C++ compiler
# F90 Name of the fortran compiler to use (if relevant)
# FFLAGS Flags to the fortran compiler
# LDFLAGS Flags to the loader
# LIBS A list of libraries
CXX = g++
CFLAGS = -g -O2
CWARNS = -Wall -W -Wshadow -fno-common
MOREFLAGS = -Wpedantic -Wpointer-arith -Wcast-qual -Wcast-align \
-Wwrite-strings -fshort-enums -Werror
# add relevant libraries and link options
LIBS =
LDFLAGS = -lgsl -lgslcblas
###########################################################################
# SECTION 4. Instructions to compile and link, with dependencies
###########################################################################
all: $(COMMAND)
.SUFFIXES:
.SUFFIXES: .o .mod .f90 .f .cpp
#%.o: %.mod ?????????
# This is the command to link all of the object files together.
# For fortran, replace CXX by F90.
$(COMMAND): $(OBJS) $(MAKEFILE)
$(CXX) -o $(COMMAND) $(OBJS) $(LDFLAGS) $(LIBS)
# Command to make object (.o) files from C++ source files (assumed to be .cpp).
# Add $(MOREFLAGS) if you want additional warning options.
.cpp.o: $(HDRS) $(MAKEFILE)
$(CXX) -c $(CFLAGS) $(CWARNS) -o $@ $<
# Commands to make object (.o) files from Fortran-90 (or beyond) and
# Fortran-77 source files (.f90 and .f, respectively).
.f90.mod:
$(F90) -c $(F90FLAGS) -o $@ $<
.f90.o:
$(F90) -c $(F90FLAGS) -o $@ $<
.f.o:
$(F90) -c $(FFLAGS) -o $@ $<
##########################################################################
# SECTION 5. Additional tasks
##########################################################################
# Delete the program and the object files (and any module files)
clean:
/bin/rm -f $(COMMAND) $(OBJS)
/bin/rm -f $(MODIR)/*.mod
# Pack up the code in a compressed gnu tar file
tarz:
tar cfvz $(TARFILE) $(MAKEFILE) $(SRCS) $(HDRS) $(MODIR) $(INPFILE)
# Pack up the code in a zip archive
zip:
zip -r $(ZIPFILE) $(MAKEFILE) $(SRCS) $(HDRS) $(MODIR) $(INPFILE)
##########################################################################
# That's all, folks!
##########################################################################