File: Makefile.env

package info (click to toggle)
sra-sdk 2.9.3+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 31,724 kB
  • sloc: ansic: 182,592; cpp: 33,717; sh: 5,385; perl: 4,969; makefile: 4,030; python: 3,560; java: 2,363; yacc: 786; lex: 416; lisp: 77; xml: 54
file content (414 lines) | stat: -rw-r--r-- 10,739 bytes parent folder | download
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# ===========================================================================
#
#                            PUBLIC DOMAIN NOTICE
#               National Center for Biotechnology Information
#
#  This software/database is a "United States Government Work" under the
#  terms of the United States Copyright Act.  It was written as part of
#  the author's official duties as a United States Government employee and
#  thus cannot be copyrighted.  This software/database is freely available
#  to the public for use. The National Library of Medicine and the U.S.
#  Government have not placed any restriction on its use or reproduction.
#
#  Although all reasonable efforts have been taken to ensure the accuracy
#  and reliability of the software and data, the NLM and the U.S.
#  Government do not and cannot warrant the performance or results that
#  may be obtained by using this software or data. The NLM and the U.S.
#  Government disclaim all warranties, express or implied, including
#  warranties of performance, merchantability or fitness for any particular
#  purpose.
#
#  Please cite the author in any work or product based on this material.
#
# ===========================================================================

# pick up dependencies from object directory
ifdef SRCDIR
	include $(wildcard *.d)
endif

# determine shell environment
include $(TOP)/build/Makefile.shell

# load build configuration
include $(CONFIG_FILE)

# normally build shared and static external libs
LIBEXT = $(LIBX) $(SHLX)

# normally build static intermediate libs
ILIBEXT = $(LIBX)

# determine BUILD
ifeq (,$(BUILD))
	BUILD = dbg
endif

# some rules are sensitive to the type of build
BUILDTYPE = $(BUILD)

# adjust settings for build
ifeq (dbg,$(BUILD))
	DEBUG := -D_DEBUGGING
endif
ifeq (prof,$(BUILD))
	DEBUG := -D_PROFILING
endif
ifeq (pur,$(BUILD))
	DEBUG := -D_DEBUGGING
	LD_PRE := purify
	LNKG = stat
endif
ifeq (pcov,$(BUILD))
	DEBUG := -D_DEBUGGING
	LD_PRE := purecov
	LNKG = stat
endif
ifeq (scm,$(BUILD))
	BUILDTYPE = rel
	CHECKSUM := --checksum
endif

ifeq (yes,$(HAS_RHOST))
	LOCAL_OR_REMOTE = remote
else
	LOCAL_OR_REMOTE = local
endif

# pre-built sra-tools are static
ifeq (1,$(WANTS_STATIC))
	STATIC = --static
	STATICSYSLIBS = --static-system-libs
endif

# drop all suffix rules
.SUFFIXES:

# load OS and COMP specific files
include $(TOP)/build/Makefile.$(OS)
include $(TOP)/build/Makefile.$(COMP)
include $(TOP)/build/Makefile.rules

# external schema modules
EXT_SCHEMA_MODULES = axf sraxf wgsxf vxf
UPDATE_SCHEMA_LIBS := $(addprefix -lw,$(EXT_SCHEMA_MODULES))
READONLY_SCHEMA_LIBS = $(addprefix -l,$(EXT_SCHEMA_MODULES))
ALWAYS_STATIC_SCHEMA_LIBS = $(addprefix -s,$(EXT_SCHEMA_MODULES))

# full directory paths
TARGDIR ?= $(OUTDIR)/$(OS)/$(TOOLSET)/$(ARCH)/$(BUILD)
BINDIR ?= $(TARGDIR)/bin
ifeq (win,$(OS))
    # on Windows, place test executables next to .dlls
    TEST_BINDIR = $(BINDIR)
else
    TEST_BINDIR = $(TARGDIR)/test-bin
endif
ILIBDIR = $(TARGDIR)/ilib
LIBDIR = $(TARGDIR)/lib
OBJDIR = $(TARGDIR)/obj/$(MODULE)

CLSPATH         ?= $(TARGDIR)/java
CLASSPATH       ?= $(CLSPATH)
CLASSDIR        ?= $(TARGDIR)/$(MODULE)
TEST_CLSPATH    ?= $(TARGDIR)/test/java
JAVASOURCEPATH  ?= $(TOP)/java

# path to the ncbi sub-directory
# this is where modules and installed schema files are kept
ifeq (win,$(OS))
    # under Windows, we are always relative to binary path
	NCBIDIR = $(BINDIR)/ncbi
else
	# under Linux and Mac, it can be binary or library
	NCBIDIR = $(LIBDIR)/ncbi $(BINDIR)/ncbi
endif

DEFAULT_CRT = /usr/lib/ncbi-vdb/kfg/certs.kfg
DEFAULT_KFG = /usr/lib/ncbi-vdb/kfg/default.kfg

# make reissue command
MAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \
    TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(OBJDIR) -f $(SRCDIR)/Makefile

JMAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \
    TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(CLASSDIR) -f $(SRCDIR)/Makefile

# directory and link creation
SUBDIRS = bin test-bin ilib lib
OUTDIRS = schema

# clean rules
stdclean:
	@ -rm -rf $(OBJDIR)
	@ -rm -rf $(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \
			$(addsuffix .*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \
			$(addsuffix -static.*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \
			$(addsuffix *,$(addprefix $(BINDIR)/,$(ALL_TOOLS) $(ALL_LIBS))) \
			$(addsuffix *,$(addprefix $(TEST_BINDIR)/,$(ALL_TOOLS) $(TEST_TOOLS)))

stdjclean:
	@ -rm -rf $(CLSPATH)

# removing symbolic links that point to specific builds
removelinks:
	@ test ! -h $(OUTDIR)/schema && rm -rf $(OUTDIR)/schema || true
	@ rm -f $(addprefix $(OUTDIR)/,$(addsuffix $(BITS),$(SUBDIRS)))
	@ rm -f $(addprefix $(OUTDIR)/,$(OUTDIRS))

$(BINDIR)/ncbi/certs.kfg: $(DEFAULT_CRT)
	@ mkdir -p $(NCBIDIR)
	@ cp -v $(DEFAULT_CRT) $@

$(BINDIR)/ncbi/default.kfg: $(DEFAULT_KFG)
	@ mkdir -p $(NCBIDIR)
	@ cp -v $(DEFAULT_KFG) $@

# create all required output directories
makedirs: $(BINDIR)/ncbi/certs.kfg $(BINDIR)/ncbi/default.kfg
	@ mkdir -p $(addprefix $(TARGDIR)/,$(SUBDIRS) obj/$(MODULE)) $(NCBIDIR)

makejdirs:
	@ mkdir -p $(CLASSDIR)

# build version include files
vers-includes: makedirs
	@ $(MAKE_CMD) -s $(TARGDIR)/$@

ifeq (win,$(OS))

# Windows doesn't really support symbolic links
# we may add them back in when our toolkit is able to create them
rebuild-dirlinks: makedirs
	@ true
else

LNDIRS = $(addprefix ln_,$(SUBDIRS))
$(LNDIRS):
	@ ln -s $(TARGDIR)/$(subst ln_,,$@) $(OUTDIR)/$(subst ln_,,$@)$(BITS)

ifdef NOREBUILD_LINKS
rebuild-dirlinks:
	@ true
else
rebuild-dirlinks: removelinks makedirs $(LNDIRS)
	@ ln -s $(VDB_INCDIR) $(OUTDIR)/schema
endif

endif

.PHONY: stdclean removelinks makedirs vers-includes rebuild-dirlinks
.PHONY: stdjclean makejdirs

# configuration targets
out:
	@ echo $(OUTDIR) > $(TOP)/build/OUTDIR.$(BUILD_OS)
	@ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks

$(RHOSTS):
	@ cat $(TOP)/rhosts/$@ >> $(TOP)/build/RHOST.$(HOST_OS)

require-proxy-exec:
	@ $(MAKE) -C $(TOP)/test/proxy_exec proxy-exec
	@ echo "PROXY_TOOL := $(BINDIR)/proxy-exec" > $(TOP)/build/RHOST.$(HOST_OS)

local:
	@ rm -f $(TOP)/build/RHOST.$(HOST_OS)

CC:
	@ echo cc > $(TOP)/build/COMP.$(OS)

GCC:
	@ echo gcc > $(TOP)/build/COMP.$(OS)

ICC:
	@ echo icc > $(TOP)/build/COMP.$(OS)

VC++:
	@ echo vc++ > $(TOP)/build/COMP.$(OS)

CLANG:
	@ echo clang > $(TOP)/build/COMP.$(OS)

static dynamic:
	@ echo "there is no longer any difference between static and dynamic builds"

debug:
	@ echo dbg > $(TOP)/build/BUILD.$(OS)

profile:
	@ echo prof > $(TOP)/build/BUILD.$(OS)

release:
	@ echo rel > $(TOP)/build/BUILD.$(OS)

scm:
	@ echo scm > $(TOP)/build/BUILD.$(OS)

pubtools: release

bindir:
	@ echo "$(BINDIR)"

targdir:
	@ echo "$(TARGDIR)"

osdir:
	@ echo "$(OUTDIR)/$(OS)"

compilers:
	@ echo "$(COMPILERS)"

architectures:
	@ echo "$(ARCHITECTURES)"

architecture:
	@ echo "$(ARCH)"

config:
	@ echo "  current build is $(LOCAL_OR_REMOTE) $(BUILD_OS) $(BUILD) $(ARCH) build using $(TOOLSET) tools"
	@ echo "  output target directory is '$(TARGDIR)'"
	@ echo

purify:
	@ echo pur > $(TOP)/build/BUILD.$(OS)

purecov:
	@ echo pcov > $(TOP)/build/BUILD.$(OS)

.PHONY: out CC GCC ICC debug profile release scm purify purecov local local require-proxy-exec $(RHOSTS) bindir report_config

# includes based upon build
ITF   = $(VDB_INCDIR)/
OSINC = $(VDB_INCDIR)/os
CCINC = $(VDB_INCDIR)/cc
XTINC = $(VDB_INCDIR)/ext
NGSINC = $(NGS_INCDIR)
OVERRIDEINC = $(TOP)/interfaces/override

# OS specific source and include dirs
SRCDIRS_OS = $(SRCDIR)/$(OS)
INCDIRS_OS = $(OSINC)/$(OS)

# most OS' have a parent type
ifdef OS_DAD

SRCDIRS_OS += $(SRCDIR)/$(OS_DAD)
INCDIRS_OS += $(OSINC)/$(OS_DAD)

# some OS' have a grandparent
ifdef OS_GDAD
SRCDIRS_OS += $(SRCDIR)/$(OS_GDAD)
INCDIRS_OS += $(OSINC)/$(OS_GDAD)
endif

endif

# compiler specific includes
INCDIRS_COMP = \
	$(CCINC)/$(COMP)/$(ARCH) \
	$(CCINC)/$(COMP)

# some compilers have a parent type
ifdef COMP_DAD

INCDIRS_COMP += \
	$(CCINC)/$(COMP_DAD)/$(ARCH) \
	$(CCINC)/$(COMP_DAD)

endif

VPATH = \
	$(SRCDIR)/$(COMP)/$(ARCH) \
	$(SRCDIR)/$(COMP) \
	$(SRCDIRS_OS) \
	$(SRCDIR)

INCDIRS = \
	$(addprefix -I,$(OVERRIDEINC)) \
	$(addprefix -I,$(SRCDIRS_OS)) \
	$(addprefix -I,$(SRCDIR) $(ITF)) \
	$(addprefix -I,$(INCDIRS_COMP)) \
	$(addprefix -I,$(INCDIRS_OS)) \
	$(addprefix -I,$(XTINC) $(NGSINC)) \
	-I.


# linker paths
LDPATHS =

ifneq (,$(HDF5_LIBDIR))
	LDPATHS += -L$(HDF5_LIBDIR)
endif
ifneq (,$(XML2_LIBDIR))
	LDPATHS += -L$(XML2_LIBDIR)
endif
ifneq (,$(MAGIC_LIBDIR))
	LDPATHS += -L$(MAGIC_LIBDIR)
endif
ifneq (,$(FUSE_LIBDIR))
	LDPATHS += -L$(FUSE_LIBDIR)
endif


# defines that describe os & architecture
DLLX ?= $(SHLX)
ARCHDEFS = -D_ARCH_BITS=__SIZEOF_POINTER__*__CHAR_BIT__ -DLIBPREFIX=$(LPFX) -DSHLIBEXT=$(DLLX)

# default tool parameters
CFLAGS	= $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS) $(DEB_CFLAGS)
CPFLAGS = $(DEBUG) $(DBG) $(CARCH) $(PROF) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS)
LDFLAGS = $(DBG) $(PROF) $(CARCH) $(MIN_DEPLOY_OS_OPT) $(LDPATHS) $(DEB_LDFLAGS)

#-------------------------------------------------------------------------------
# runtests
#
# MallocScribble=1 is for catching allocation problems on Mac
#
ifeq ($(RUNTESTS_OVERRIDE),)
runtests: all $(TEST_TOOLS)
	@ export VDB_CONFIG=$(VDB_CONFIG);export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;export MallocScribble=1;\
	for i in $(TEST_TOOLS);\
	do\
		echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\
		echo Run $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \
		if [ "$$r" != "0" ] ; then exit $$r; fi; \
	done

.PHONY: runtests
endif

#-------------------------------------------------------------------------------
# slowtests
#
# $(SLOWTESTSDATADIR) should be used to create temporary test files
SLOWTESTSDATADIR ?= /panfs/pan1.be-md.ncbi.nlm.nih.gov/sra-test/slowtests/$(shell whoami)

slowtests: all $(SLOW_TEST_TOOLS)
	@ export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;\
	for i in $(SLOW_TEST_TOOLS);\
	do\
		echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\
		echo Run $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \
		if [ "$$r" != "0" ] ; then exit $$r; fi; \
	done

.PHONY: slowtests

#-------------------------------------------------------------------------------
# all-cmn
#
# Common target to trigger build of all tools
#
$(TARGDIR)/all-cmn: $(addprefix $(BINDIR)/,$(ALL_TOOLS))

.PHONY: $(TARGDIR)/all-cmn

#-------------------------------------------------------------------------------
# std-cmn
#
# Common target to trigger build of external visibility tools
#
$(TARGDIR)/std-cmn: $(addprefix $(BINDIR)/,$(EXT_TOOLS))

.PHONY: $(TARGDIR)/std-cmn