GNUmakefile 10.1 KB
Newer Older
Hal Finkel's avatar
Hal Finkel committed
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
#                    Copyright (C) 2015, UChicago Argonne, LLC
#                               All Rights Reserved
# 
#                               Generic IO (ANL-15-066)
#                     Hal Finkel, Argonne National Laboratory
# 
#                              OPEN SOURCE LICENSE
# 
# Under the terms of Contract No. DE-AC02-06CH11357 with UChicago Argonne,
# LLC, the U.S. Government retains certain rights in this software.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 
#   1. Redistributions of source code must retain the above copyright notice,
#      this list of conditions and the following disclaimer.
# 
#   2. Redistributions in binary form must reproduce the above copyright
#      notice, this list of conditions and the following disclaimer in the
#      documentation and/or other materials provided with the distribution.
# 
#   3. Neither the names of UChicago Argonne, LLC or the Department of Energy
#      nor the names of its contributors may be used to endorse or promote
#      products derived from this software without specific prior written
#      permission.
# 
# *****************************************************************************
# 
#                                  DISCLAIMER
# THE SOFTWARE IS SUPPLIED “AS IS” WITHOUT WARRANTY OF ANY KIND.  NEITHER THE
# UNTED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR
# UCHICAGO ARGONNE, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY,
# EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE
# ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, DATA, APPARATUS,
# PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE
# PRIVATELY OWNED RIGHTS.
# 
# *****************************************************************************

40
41
42
43
44
45
46
47
48
CC = gcc
CXX = g++

MPICC = mpicc
MPICXX = mpicxx

all: fe-progs mpi-progs
sql: fe-sqlite

49
50
51
52
53
54
55
56
57
58
59
BLOSC_CPPFLAGS := \
	-Ithirdparty/blosc \
	-DHAVE_LZ4 -DHAVE_SNAPPY -DHAVE_ZLIB -DHAVE_ZSTD \
	-Ithirdparty/blosc/internal-complibs/zlib-1.2.8 \
	-Ithirdparty/blosc/internal-complibs/lz4-1.7.2 \
	-Ithirdparty/blosc/internal-complibs/snappy-1.1.1 \
	-Ithirdparty/blosc/internal-complibs/zstd-0.7.4 \
	-Ithirdparty/blosc/internal-complibs/zstd-0.7.4/legacy \
	-Ithirdparty/blosc/internal-complibs/zstd-0.7.4/compress \
	-Ithirdparty/blosc/internal-complibs/zstd-0.7.4/common \
	-Ithirdparty/blosc/internal-complibs/zstd-0.7.4/dictBuilder \
Hal Finkel's avatar
Hal Finkel committed
60
61
	-Ithirdparty/blosc/internal-complibs/zstd-0.7.4/decompress \
	-Ithirdparty/SZ/sz/include
62

63
BASE_CPPFLAGS := $(BLOSC_CPPFLAGS) -I. -D__STDC_CONSTANT_MACROS
64

Thomas Uram's avatar
Thomas Uram committed
65
66
67
68
69
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
    OPENMPFLAG=-fopenmp
endif

70
FEDIR = frontend
71
FE_CFLAGS := -g -fPIC -O3 $(OPENMPFLAG) -std=gnu99
72
FE_CPPFLAGS := $(BASE_CPPFLAGS) -Ithirdparty/sqlite -DGENERICIO_NO_MPI
73
74

MPIDIR = mpi
75
MPI_CFLAGS := -g -O3 $(OPENMPFLAG) -std=gnu99
76
MPI_CPPFLAGS := $(BASE_CPPFLAGS)
77
78
79
80

$(FEDIR):
	mkdir -p $(FEDIR)

81
82
$(FEDIR)/%.o: %.c | $(FEDIR)
	mkdir -p $(dir $@)
83
84
85
	$(CC) $(FE_CFLAGS) $(FE_CPPFLAGS) -c -o $@ $<

$(FEDIR)/%.o: %.cxx | $(FEDIR)
86
	mkdir -p $(dir $@)
87
88
	$(CXX) $(FE_CFLAGS) $(FE_CPPFLAGS) -c -o $@ $<

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
BLOSC_O := \
	thirdparty/blosc/blosc.o \
	thirdparty/blosc/blosclz.o \
	thirdparty/blosc/shuffle.o \
	thirdparty/blosc/bitshuffle-generic.o \
	thirdparty/blosc/shuffle-generic.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/gzwrite.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/crc32.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/inffast.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/zutil.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/infback.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/deflate.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/inflate.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/gzread.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/gzlib.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/gzclose.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/uncompr.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/compress.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/inftrees.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/trees.o \
	thirdparty/blosc/internal-complibs/zlib-1.2.8/adler32.o \
	thirdparty/blosc/internal-complibs/lz4-1.7.2/lz4.o \
	thirdparty/blosc/internal-complibs/lz4-1.7.2/lz4hc.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v01.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v02.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v03.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v06.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v04.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v05.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/fse_compress.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/zstd_compress.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/huf_compress.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/zbuff_compress.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/common/entropy_common.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/common/xxhash.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/common/zstd_common.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/common/fse_decompress.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/dictBuilder/zdict.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/dictBuilder/divsufsort.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/decompress/zstd_decompress.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/decompress/huf_decompress.o \
	thirdparty/blosc/internal-complibs/zstd-0.7.4/decompress/zbuff_decompress.o \
	thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy-c.o \
	thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy.o \
	thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy-sinksource.o \
Hal Finkel's avatar
Hal Finkel committed
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
	thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy-stubs-internal.o \
	thirdparty/SZ/sz/src/ByteToolkit.o \
	thirdparty/SZ/sz/src/dataCompression.o \
	thirdparty/SZ/sz/src/DynamicIntArray.o \
	thirdparty/SZ/sz/src/iniparser.o \
	thirdparty/SZ/sz/src/CompressElement.o \
	thirdparty/SZ/sz/src/DynamicByteArray.o \
	thirdparty/SZ/sz/src/rw.o \
	thirdparty/SZ/sz/src/TightDataPointStorageI.o \
	thirdparty/SZ/sz/src/TightDataPointStorageD.o \
	thirdparty/SZ/sz/src/TightDataPointStorageF.o \
	thirdparty/SZ/sz/src/conf.o \
	thirdparty/SZ/sz/src/DynamicDoubleArray.o \
	thirdparty/SZ/sz/src/TypeManager.o \
	thirdparty/SZ/sz/src/dictionary.o \
	thirdparty/SZ/sz/src/DynamicFloatArray.o \
	thirdparty/SZ/sz/src/VarSet.o \
	thirdparty/SZ/sz/src/callZlib.o \
	thirdparty/SZ/sz/src/Huffman.o \
	thirdparty/SZ/sz/src/sz_float.o \
	thirdparty/SZ/sz/src/sz_double.o \
	thirdparty/SZ/sz/src/sz_int8.o \
	thirdparty/SZ/sz/src/sz_int16.o \
	thirdparty/SZ/sz/src/sz_int32.o \
	thirdparty/SZ/sz/src/sz_int64.o \
	thirdparty/SZ/sz/src/sz_uint8.o \
	thirdparty/SZ/sz/src/sz_uint16.o \
	thirdparty/SZ/sz/src/sz_uint32.o \
	thirdparty/SZ/sz/src/sz_uint64.o \
	thirdparty/SZ/sz/src/szd_uint8.o \
	thirdparty/SZ/sz/src/szd_uint16.o \
	thirdparty/SZ/sz/src/szd_uint32.o \
	thirdparty/SZ/sz/src/szd_uint64.o \
	thirdparty/SZ/sz/src/szd_float.o \
	thirdparty/SZ/sz/src/szd_double.o \
	thirdparty/SZ/sz/src/szd_int8.o \
	thirdparty/SZ/sz/src/szd_int16.o \
	thirdparty/SZ/sz/src/szd_int32.o \
	thirdparty/SZ/sz/src/szd_int64.o \
	thirdparty/SZ/sz/src/sz.o \
	thirdparty/SZ/sz/src/sz_float_pwr.o \
	thirdparty/SZ/sz/src/sz_double_pwr.o \
	thirdparty/SZ/sz/src/szd_float_pwr.o \
177
178
179
180
181
	thirdparty/SZ/sz/src/szd_double_pwr.o \
	thirdparty/SZ/sz/src/sz_double_ts.o \
	thirdparty/SZ/sz/src/sz_float_ts.o \
	thirdparty/SZ/sz/src/szd_double_ts.o \
	thirdparty/SZ/sz/src/szd_float_ts.o
182
183

FE_BLOSC_O := $(addprefix $(FEDIR)/,$(BLOSC_O))
Hal Finkel's avatar
Hal Finkel committed
184
185

$(FEDIR)/GenericIOPrint: $(FEDIR)/GenericIOPrint.o $(FEDIR)/GenericIO.o $(FE_BLOSC_O)
186
187
	$(CXX) $(FE_CFLAGS) -o $@ $^ 

Hal Finkel's avatar
Hal Finkel committed
188
$(FEDIR)/GenericIOVerify: $(FEDIR)/GenericIOVerify.o $(FEDIR)/GenericIO.o $(FE_BLOSC_O)
189
190
191
192
193
194
195
196
	$(CXX) $(FE_CFLAGS) -o $@ $^ 

FE_UNAME := $(shell uname -s)
ifeq ($(FE_UNAME),Darwin)
FE_SHARED := -bundle
else
FE_SHARED := -shared
endif
197
198
199
200
201

$(FEDIR)/libpygio.so: $(FEDIR)/GenericIO.o $(FEDIR)/python/lib/gio.o $(FE_BLOSC_O)
	$(CXX) $(FE_CFLAGS) $(FE_SHARED) -o $@ $^

$(FEDIR)/GenericIOSQLite.so: $(FEDIR)/GenericIOSQLite.o $(FEDIR)/GenericIO.o $(FE_BLOSC_O)
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
	$(CXX) $(FE_CFLAGS) $(FE_SHARED) -o $@ $^

SQLITE_CPPFLAGS := -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_DISABLE_DIRSYNC=1 -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY=1 -DSQLITE_ENABLE_LOAD_EXTENSION=1 -DHAVE_READLINE=1

$(FEDIR)/sqbuild:
	mkdir -p $(FEDIR)/sqbuild

$(FEDIR)/sqbuild/%.o: thirdparty/sqlite/%.c | $(FEDIR)/sqbuild
	$(CC) $(FE_CFLAGS) $(FE_CPPFLAGS) $(SQLITE_CPPFLAGS) -c -o $@ $<

$(FEDIR)/sqlite3: $(FEDIR)/sqbuild/sqlite3.o $(FEDIR)/sqbuild/shell.o
	$(CC) $(FE_CFLAGS) -o $@ $^ -pthread -lreadline -lrt -ldl

$(MPIDIR):
	mkdir -p $(MPIDIR)

218
219
$(MPIDIR)/%.o: %.c | $(MPIDIR)
	mkdir -p $(dir $@)
220
221
222
	$(MPICC) $(MPI_CFLAGS) $(MPI_CPPFLAGS) -c -o $@ $<

$(MPIDIR)/%.o: %.cxx | $(MPIDIR)
223
	mkdir -p $(dir $@)
224
225
	$(MPICXX) $(MPI_CFLAGS) $(MPI_CPPFLAGS) -c -o $@ $<

226
MPI_BLOSC_O := $(addprefix $(MPIDIR)/,$(BLOSC_O))
Hal Finkel's avatar
Hal Finkel committed
227
228

$(MPIDIR)/GenericIOPrint: $(MPIDIR)/GenericIOPrint.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
229
230
	$(MPICXX) $(MPI_CFLAGS) -o $@ $^ 

Hal Finkel's avatar
Hal Finkel committed
231
$(MPIDIR)/GenericIOVerify: $(MPIDIR)/GenericIOVerify.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
232
233
	$(MPICXX) $(MPI_CFLAGS) -o $@ $^ 

Hal Finkel's avatar
Hal Finkel committed
234
$(MPIDIR)/GenericIOBenchmarkRead: $(MPIDIR)/GenericIOBenchmarkRead.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
235
236
	$(MPICXX) $(MPI_CFLAGS) -o $@ $^ 

Hal Finkel's avatar
Hal Finkel committed
237
$(MPIDIR)/GenericIOBenchmarkWrite: $(MPIDIR)/GenericIOBenchmarkWrite.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
238
239
	$(MPICXX) $(MPI_CFLAGS) -o $@ $^ 

240
241
242
$(MPIDIR)/GenericIORewrite: $(MPIDIR)/GenericIORewrite.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
	$(MPICXX) $(MPI_CFLAGS) -o $@ $^ 

243
frontend-progs: $(FEDIR)/GenericIOPrint $(FEDIR)/GenericIOVerify $(FEDIR)/libpygio.so
244
245
fe-progs: frontend-progs

246
mpi-progs: $(MPIDIR)/GenericIOPrint $(MPIDIR)/GenericIOVerify $(MPIDIR)/GenericIOBenchmarkRead $(MPIDIR)/GenericIOBenchmarkWrite $(MPIDIR)/GenericIORewrite
247
248
249
250
251

frontend-sqlite: $(FEDIR)/GenericIOSQLite.so $(FEDIR)/sqlite3
fe-sqlite: frontend-sqlite

clean:
Hal Finkel's avatar
Hal Finkel committed
252
	rm -rf frontend mpi python/genericio.pyc
253