source: GNUmakefile @ 5e1952a

Revision 5e1952a, 8.3 KB checked in by Thomas Uram <turam@…>, 7 years ago (diff)

Use fopenmp only on Linux

  • Property mode set to 100644
Line 
1#                    Copyright (C) 2015, UChicago Argonne, LLC
2#                               All Rights Reserved
3#
4#                               Generic IO (ANL-15-066)
5#                     Hal Finkel, Argonne National Laboratory
6#
7#                              OPEN SOURCE LICENSE
8#
9# Under the terms of Contract No. DE-AC02-06CH11357 with UChicago Argonne,
10# LLC, the U.S. Government retains certain rights in this software.
11#
12# Redistribution and use in source and binary forms, with or without
13# modification, are permitted provided that the following conditions are met:
14#
15#   1. Redistributions of source code must retain the above copyright notice,
16#      this list of conditions and the following disclaimer.
17#
18#   2. Redistributions in binary form must reproduce the above copyright
19#      notice, this list of conditions and the following disclaimer in the
20#      documentation and/or other materials provided with the distribution.
21#
22#   3. Neither the names of UChicago Argonne, LLC or the Department of Energy
23#      nor the names of its contributors may be used to endorse or promote
24#      products derived from this software without specific prior written
25#      permission.
26#
27# *****************************************************************************
28#
29#                                  DISCLAIMER
30# THE SOFTWARE IS SUPPLIED “AS IS” WITHOUT WARRANTY OF ANY KIND.  NEITHER THE
31# UNTED STATES GOVERNMENT, NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR
32# UCHICAGO ARGONNE, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY,
33# EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE
34# ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, DATA, APPARATUS,
35# PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE
36# PRIVATELY OWNED RIGHTS.
37#
38# *****************************************************************************
39
40CC = gcc
41CXX = g++
42
43MPICC = mpicc
44MPICXX = mpicxx
45
46all: fe-progs mpi-progs
47sql: fe-sqlite
48
49BLOSC_CPPFLAGS := \
50        -Ithirdparty/blosc \
51        -DHAVE_LZ4 -DHAVE_SNAPPY -DHAVE_ZLIB -DHAVE_ZSTD \
52        -Ithirdparty/blosc/internal-complibs/zlib-1.2.8 \
53        -Ithirdparty/blosc/internal-complibs/lz4-1.7.2 \
54        -Ithirdparty/blosc/internal-complibs/snappy-1.1.1 \
55        -Ithirdparty/blosc/internal-complibs/zstd-0.7.4 \
56        -Ithirdparty/blosc/internal-complibs/zstd-0.7.4/legacy \
57        -Ithirdparty/blosc/internal-complibs/zstd-0.7.4/compress \
58        -Ithirdparty/blosc/internal-complibs/zstd-0.7.4/common \
59        -Ithirdparty/blosc/internal-complibs/zstd-0.7.4/dictBuilder \
60        -Ithirdparty/blosc/internal-complibs/zstd-0.7.4/decompress
61
62BASE_CPPFLAGS := $(BLOSC_CPPFLAGS) -I. -D__STDC_CONSTANT_MACROS
63
64UNAME_S := $(shell uname -s)
65ifeq ($(UNAME_S),Linux)
66    OPENMPFLAG=-fopenmp
67endif
68
69FEDIR = frontend
70FE_CFLAGS := -g -fPIC -O3 $(OPENMPFLAG)
71FE_CPPFLAGS := $(BASE_CPPFLAGS) -Ithirdparty/sqlite -DGENERICIO_NO_MPI
72
73MPIDIR = mpi
74MPI_CFLAGS := -g -O3 $(OPENMPFLAG)
75MPI_CPPFLAGS := $(BASE_CPPFLAGS)
76
77$(FEDIR):
78        mkdir -p $(FEDIR)
79
80$(FEDIR)/%.o: %.c | $(FEDIR)
81        mkdir -p $(dir $@)
82        $(CC) $(FE_CFLAGS) $(FE_CPPFLAGS) -c -o $@ $<
83
84$(FEDIR)/%.o: %.cxx | $(FEDIR)
85        mkdir -p $(dir $@)
86        $(CXX) $(FE_CFLAGS) $(FE_CPPFLAGS) -c -o $@ $<
87
88BLOSC_O := \
89        thirdparty/blosc/blosc.o \
90        thirdparty/blosc/blosclz.o \
91        thirdparty/blosc/shuffle.o \
92        thirdparty/blosc/bitshuffle-generic.o \
93        thirdparty/blosc/shuffle-generic.o \
94        thirdparty/blosc/internal-complibs/zlib-1.2.8/gzwrite.o \
95        thirdparty/blosc/internal-complibs/zlib-1.2.8/crc32.o \
96        thirdparty/blosc/internal-complibs/zlib-1.2.8/inffast.o \
97        thirdparty/blosc/internal-complibs/zlib-1.2.8/zutil.o \
98        thirdparty/blosc/internal-complibs/zlib-1.2.8/infback.o \
99        thirdparty/blosc/internal-complibs/zlib-1.2.8/deflate.o \
100        thirdparty/blosc/internal-complibs/zlib-1.2.8/inflate.o \
101        thirdparty/blosc/internal-complibs/zlib-1.2.8/gzread.o \
102        thirdparty/blosc/internal-complibs/zlib-1.2.8/gzlib.o \
103        thirdparty/blosc/internal-complibs/zlib-1.2.8/gzclose.o \
104        thirdparty/blosc/internal-complibs/zlib-1.2.8/uncompr.o \
105        thirdparty/blosc/internal-complibs/zlib-1.2.8/compress.o \
106        thirdparty/blosc/internal-complibs/zlib-1.2.8/inftrees.o \
107        thirdparty/blosc/internal-complibs/zlib-1.2.8/trees.o \
108        thirdparty/blosc/internal-complibs/zlib-1.2.8/adler32.o \
109        thirdparty/blosc/internal-complibs/lz4-1.7.2/lz4.o \
110        thirdparty/blosc/internal-complibs/lz4-1.7.2/lz4hc.o \
111        thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v01.o \
112        thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v02.o \
113        thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v03.o \
114        thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v06.o \
115        thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v04.o \
116        thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v05.o \
117        thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/fse_compress.o \
118        thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/zstd_compress.o \
119        thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/huf_compress.o \
120        thirdparty/blosc/internal-complibs/zstd-0.7.4/compress/zbuff_compress.o \
121        thirdparty/blosc/internal-complibs/zstd-0.7.4/common/entropy_common.o \
122        thirdparty/blosc/internal-complibs/zstd-0.7.4/common/xxhash.o \
123        thirdparty/blosc/internal-complibs/zstd-0.7.4/common/zstd_common.o \
124        thirdparty/blosc/internal-complibs/zstd-0.7.4/common/fse_decompress.o \
125        thirdparty/blosc/internal-complibs/zstd-0.7.4/dictBuilder/zdict.o \
126        thirdparty/blosc/internal-complibs/zstd-0.7.4/dictBuilder/divsufsort.o \
127        thirdparty/blosc/internal-complibs/zstd-0.7.4/decompress/zstd_decompress.o \
128        thirdparty/blosc/internal-complibs/zstd-0.7.4/decompress/huf_decompress.o \
129        thirdparty/blosc/internal-complibs/zstd-0.7.4/decompress/zbuff_decompress.o \
130        thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy-c.o \
131        thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy.o \
132        thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy-sinksource.o \
133        thirdparty/blosc/internal-complibs/snappy-1.1.1/snappy-stubs-internal.o
134
135FE_BLOSC_O := $(addprefix $(FEDIR)/,$(BLOSC_O))
136
137$(FEDIR)/GenericIOPrint: $(FEDIR)/GenericIOPrint.o $(FEDIR)/GenericIO.o $(FE_BLOSC_O)
138        $(CXX) $(FE_CFLAGS) -o $@ $^
139
140$(FEDIR)/GenericIOVerify: $(FEDIR)/GenericIOVerify.o $(FEDIR)/GenericIO.o $(FE_BLOSC_O)
141        $(CXX) $(FE_CFLAGS) -o $@ $^
142
143FE_UNAME := $(shell uname -s)
144ifeq ($(FE_UNAME),Darwin)
145FE_SHARED := -bundle
146else
147FE_SHARED := -shared
148endif
149
150$(FEDIR)/libpygio.so: $(FEDIR)/GenericIO.o $(FEDIR)/python/lib/gio.o $(FE_BLOSC_O)
151        $(CXX) $(FE_CFLAGS) $(FE_SHARED) -o $@ $^
152
153$(FEDIR)/GenericIOSQLite.so: $(FEDIR)/GenericIOSQLite.o $(FEDIR)/GenericIO.o $(FE_BLOSC_O)
154        $(CXX) $(FE_CFLAGS) $(FE_SHARED) -o $@ $^
155
156SQLITE_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
157
158$(FEDIR)/sqbuild:
159        mkdir -p $(FEDIR)/sqbuild
160
161$(FEDIR)/sqbuild/%.o: thirdparty/sqlite/%.c | $(FEDIR)/sqbuild
162        $(CC) $(FE_CFLAGS) $(FE_CPPFLAGS) $(SQLITE_CPPFLAGS) -c -o $@ $<
163
164$(FEDIR)/sqlite3: $(FEDIR)/sqbuild/sqlite3.o $(FEDIR)/sqbuild/shell.o
165        $(CC) $(FE_CFLAGS) -o $@ $^ -pthread -lreadline -lrt -ldl
166
167$(MPIDIR):
168        mkdir -p $(MPIDIR)
169
170$(MPIDIR)/%.o: %.c | $(MPIDIR)
171        mkdir -p $(dir $@)
172        $(MPICC) $(MPI_CFLAGS) $(MPI_CPPFLAGS) -c -o $@ $<
173
174$(MPIDIR)/%.o: %.cxx | $(MPIDIR)
175        mkdir -p $(dir $@)
176        $(MPICXX) $(MPI_CFLAGS) $(MPI_CPPFLAGS) -c -o $@ $<
177
178MPI_BLOSC_O := $(addprefix $(MPIDIR)/,$(BLOSC_O))
179
180$(MPIDIR)/GenericIOPrint: $(MPIDIR)/GenericIOPrint.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
181        $(MPICXX) $(MPI_CFLAGS) -o $@ $^
182
183$(MPIDIR)/GenericIOVerify: $(MPIDIR)/GenericIOVerify.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
184        $(MPICXX) $(MPI_CFLAGS) -o $@ $^
185
186$(MPIDIR)/GenericIOBenchmarkRead: $(MPIDIR)/GenericIOBenchmarkRead.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
187        $(MPICXX) $(MPI_CFLAGS) -o $@ $^
188
189$(MPIDIR)/GenericIOBenchmarkWrite: $(MPIDIR)/GenericIOBenchmarkWrite.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
190        $(MPICXX) $(MPI_CFLAGS) -o $@ $^
191
192$(MPIDIR)/GenericIORewrite: $(MPIDIR)/GenericIORewrite.o $(MPIDIR)/GenericIO.o $(MPI_BLOSC_O)
193        $(MPICXX) $(MPI_CFLAGS) -o $@ $^
194
195frontend-progs: $(FEDIR)/GenericIOPrint $(FEDIR)/GenericIOVerify $(FEDIR)/libpygio.so
196fe-progs: frontend-progs
197
198mpi-progs: $(MPIDIR)/GenericIOPrint $(MPIDIR)/GenericIOVerify $(MPIDIR)/GenericIOBenchmarkRead $(MPIDIR)/GenericIOBenchmarkWrite $(MPIDIR)/GenericIORewrite
199
200frontend-sqlite: $(FEDIR)/GenericIOSQLite.so $(FEDIR)/sqlite3
201fe-sqlite: frontend-sqlite
202
203clean:
204        rm -rf frontend mpi python/genericio.pyc
205
Note: See TracBrowser for help on using the repository browser.