forked from MeshToolkit/MSTK
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.standalone
181 lines (104 loc) · 3.58 KB
/
Makefile.standalone
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
176
177
178
179
180
181
# USE THIS MAKEFILE ONLY IF YOU HAVE TO
# CMAKE IS THE PREFERRED WAY TO BUILD MSTK
# Get the machine type and kernel name. Piping the output of uname
# through (tr '[A-Z]' '[a-z]') converts the string to lower case
ARCH := $(shell (uname -m))
OS := $(shell (uname -s))
ARCHOS := $(ARCH)_$(OS)
ifeq ($(ARCHOS),i686_Linux)
CC = mpicc
CFLAGS = -Wall -Wunused-variable -ansi
DEBUGFLAGS = -g -DDEBUG
OPTFLAGS = -O # -pg for PROFILING
DEFINES := -DLINUX -DHASHTABLE -DHAVE_MPI
LDFLAGS := -lm
endif
ifeq ($(ARCHOS),x86_64_Linux)
CC = mpicc
CFLAGS = -W -Wall -Wno-unused -ansi
DEBUGFLAGS = -g -DDEBUG
OPTFLAGS = -O2 -march=k8 # -pg for PROFILING
DEFINES = -DLINUX -DHASHTABLE -DHAVE_MPI
LDFLAGS := -lm
endif
# METIS DIRECTORY
METISDIR = $(HOME)/packages/metis-4.0
METISINC = $(METISDIR)/Lib
# EXODUS II Directory
EXODUSIIDIR = $(HOME)/packages/ACCESS/libraries/exodusii
EXODUSIIINC = $(EXODUSIIDIR)/cbind/include
# NETCDF DIRECTORY
NETCDFDIR = $(HOME)/packages/netcdf-4.0.1
NETCDFINC = $(NETCDFDIR)/include
NETCDFLIB = $(NETCDFDIR)/lib
# STANDARD DIRECTORY
TOPDIR = $(HOME)
DEPINCS := -I$(METISINC) -I$(NETCDFINC) -I$(EXODUSIIINC)
# DEVELOP DIRECTORY
TOPDIR = $(HOME)/develop
DEPINCS := -I$(METISINC) -I$(NETCDFINC) -I$(EXODUSIIINC)
# ---------------- DO NOT EDIT BELOW THIS LINE --------------------------------
.PHONY: all
all: debug opt
LIBDIR = ./lib
INCDIR = -I./include $(DEPINCS)
srcdirs := src/util src/base src/hilev src/misc src/par
DEFINES := $(DEFINES)
incdirs := include
# Sources with path
srcs1 := $(foreach dir,$(srcdirs),$(wildcard $(dir)/*.c))
# Headers with path
hdrs := $(foreach dir,$(incdirs),$(wildcard $(dir)/*.h))
# Sources without path
srcs := $(notdir $(srcs1))
# Object files without path
objs := $(srcs:.c=.o)
# Object file directories (-d is for debug)
objdir-d := obj/$(ARCHOS)-d
objdir := obj/$(ARCHOS)
# Debug object files with path
obj2-d := $(addprefix $(objdir-d)/,$(objs))
# Optimized object files with path
obj2 := $(addprefix $(objdir)/,$(objs))
# Directory for libraries
libdir := lib/$(ARCHOS)
VPATH = $(objdir-d):$(objdir):$(dirs)
# DEBUG VERSION OF THE LIBRARY
debug: $(objdir-d) $(libdir) $(obj2-d)
ar rcv $(LIBDIR)/$(ARCHOS)/libmstk-d.a $(obj2-d)
$(objdir-d):
mkdir -p $(objdir-d)
obj/$(ARCHOS)-d/%.o: src/util/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@
obj/$(ARCHOS)-d/%.o: src/base/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@
obj/$(ARCHOS)-d/%.o: src/hilev/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@
obj/$(ARCHOS)-d/%.o: src/misc/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@
obj/$(ARCHOS)-d/%.o: src/par/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@
# OPTIMIZED VERSION OF THE LIBRARY
opt : $(objdir) $(libdir) $(obj2)
ar rcv $(LIBDIR)/$(ARCHOS)/libmstk.a $(obj2)
$(objdir):
mkdir -p $(objdir)
obj/$(ARCHOS)/%.o: src/util/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(OPTFLAGS) -c $< -o $@
obj/$(ARCHOS)/%.o: src/base/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(OPTFLAGS) -c $< -o $@
obj/$(ARCHOS)/%.o: src/hilev/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(OPTFLAGS) -c $< -o $@
obj/$(ARCHOS)/%.o: src/misc/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(OPTFLAGS) -c $< -o $@
obj/$(ARCHOS)/%.o: src/par/%.c
$(CC) $(DEFINES) $(INCDIR) $(CFLAGS) $(OPTFLAGS) -c $< -o $@
$(libdir):
mkdir -p $(libdir)
# CLEAN
clean :
rm -f $(obj2-d) $(obj2) $(LIBDIR)/$(ARCHOS)/*.a
# DEPEND
depend:
makedepend $(INCDIR) $(temp)
# DO NOT DELETE THIS LINE -- make depend depends on it.