File: Makefile.shell

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 (187 lines) | stat: -rw-r--r-- 5,968 bytes parent folder | download | duplicates (3)
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
# ===========================================================================
#
#                            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.
#
# ===========================================================================

CONFIG_FILE = $(TOP)/build/Makefile.config
ifeq (no, $(shell test -f $(CONFIG_FILE) && echo yes || echo no))
    $(error "*** File '$(CONFIG_FILE)' is missing. Please run $(TOP)/configure")
endif

# determine OS
UNAME = $(shell uname -s)

HOST_OS = ''
ifeq (Darwin, $(UNAME))
	HOST_OS = mac
endif
ifeq (Linux, $(UNAME))
	HOST_OS = linux
	OS_DISTRIBUTOR = $(shell lsb_release -si)
	EXECMDF = $(TOP)/build/ld.linux.exe_cmd.sh
	ifeq (no, $(shell test -f $(EXECMDF) && echo yes || echo no))
        	$(error "*** File '$(EXECMDF)' is missing. Please run $(TOP)/configure")
	endif
endif
ifeq (SunOS, $(UNAME))
	HOST_OS = sun
	ARCHITECTURES = x86_64 i386
endif
ifeq (xCYGWIN, $(findstring xCYGWIN,x$(UNAME)))
	HOST_OS = win
endif
ifeq (xMINGW, $(findstring xMINGW,x$(UNAME)))
	HOST_OS = win
endif
# handle all other OSes (like BSD or Hurd) as if they were linux (see bug #627861)
ifeq ($(HOST_OS), '')
	HOST_OS = linux
endif

# assume build OS is the same as host OS
OS = $(HOST_OS)
BUILD_OS = $(OS)

# determine ARCH
HOST_ARCH=''
ARCHITECTURES = default
ifeq (mac,$(HOST_OS))
	HOST_ARCH = $(shell $(TOP)/build/mac.arch.sh)
	OS_ARCH = $(shell perl $(TOP)/setup/os-arch.perl)
	CONFIG_FILE_OA = $(TOP)/build/Makefile.config.$(OS_ARCH)
	ifeq (no, $(shell test -f $(CONFIG_FILE_OA) && echo yes || echo no))
    	$(error "*** File '$(CONFIG_FILE_OA)' is missing. Please run $(TOP)/configure")
	endif
	ifeq (no, $(shell grep CONFIGURE_FOUND_XML2 $(CONFIG_FILE_OA) && echo yes || echo no))
    	$(error "*** 'CONFIGURE_FOUND_XML2' is missing in $(CONFIG_FILE_OA). Please run $(TOP)/configure")
	endif
else
	MARCH = $(shell uname -m)

	ifeq (i386, $(MARCH))
		HOST_ARCH = i386
	endif
	ifeq (i486, $(MARCH))
		HOST_ARCH = i386
	endif
	ifeq (i586, $(MARCH))
		HOST_ARCH = i386
	endif
	ifeq (i686, $(MARCH))
		ifeq (WOW64x, $(findstring WOW64x,$(UNAME)x))
			# 64-bit capable Cygwin. Analyze the version of cl to set the corect architecture
			CL = $(shell cl.exe 2>&1 >/dev/null)
			ifeq (for x64, $(findstring for x64, $(CL)))
				HOST_ARCH = x86_64
			else
				HOST_ARCH = i386
			endif			
		else
			HOST_ARCH = i386
		endif	
	endif
	ifeq (x86_64, $(MARCH))
		HOST_ARCH = x86_64
	endif
	ifeq (i86pc, $(MARCH))
		HOST_ARCH = x86_64
		ARCHITECTURES = x86_64 i386
	endif
	ifeq (sun4v,$(MARCH))
		HOST_ARCH = sparc64
		ARCHITECTURES = sparc64 sparc32
	endif
endif
# Handle all other architectures equivalent as i386 (see bug #627861)
ifeq ($(ARCH),'')
	ARCH = i386
endif

ARCH = $(HOST_ARCH)
REMOTE_ARCH = $(ARCH)

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

# determine SRCDIR
ifdef MODULE
    SRCDIR=$(TOP)/$(MODULE)
else
    SRCDIR=$(TOP)
endif

# set COMP, LNKG and BUILD
COMP = $(shell test -f $(TOP)/build/COMP && mv $(TOP)/build/COMP $(TOP)/build/COMP.$(OS); test -f $(TOP)/build/COMP.$(OS) && cat $(TOP)/build/COMP.$(OS) || echo gcc)
LNKG = $(shell test -f $(TOP)/build/STATIC && mv $(TOP)/build/STATIC $(TOP)/build/LNKG.$(OS) && echo stat > $(TOP)/build/LNKG.$(OS); test -f $(TOP)/build/LNKG.$(OS) && cat $(TOP)/build/LNKG.$(OS) || echo stat)
BUILD = $(shell test -f $(TOP)/build/BUILD && mv $(TOP)/build/BUILD $(TOP)/build/BUILD.$(OS); test -f $(TOP)/build/BUILD.$(OS) && cat $(TOP)/build/BUILD.$(OS) || echo dbg)
TOOLSET := $(COMP)

ifdef USE_GCC_IF_ICC
    ifeq (icc,$(COMP))
        COMP = gcc
    endif
    ifeq (clang,$(COMP))
        COMP = gcc
    endif
endif

RHOSTS = $(shell (test -d $(TOP)/rhosts && test -n "$$(ls $(TOP)/rhosts/)") && \
                  ls $(TOP)/rhosts/ | xargs -n1 basename | grep -v CVS | grep -v example | grep -v "~")

# detect RHOST
HAS_RHOST = $(shell test -f $(TOP)/build/RHOST.$(HOST_OS) && echo yes || echo no)
ifeq (yes,$(HAS_RHOST))
    include $(TOP)/build/RHOST.$(HOST_OS)
	ifeq (,$(RPORT))
		RPORT = 20000
	endif
	BUILD_OS = r$(OS)
	REMOTE_ARCH = $(ARCH)
	ifeq (,$(LHOME))
	    LHOME=$(HOME)
	endif
endif

# set OUTDIR
ifndef OUTDIR
	OUTDIR = $(shell test -f $(TOP)/build/OUTDIR && mv $(TOP)/build/OUTDIR $(TOP)/build/OUTDIR.$(BUILD_OS); test -f $(TOP)/build/OUTDIR.$(BUILD_OS) && cat $(TOP)/build/OUTDIR.$(BUILD_OS) || echo $(TOP))
	ifeq (,$(OUTDIR))
		OUTDIR = $(TOP)
	endif
endif
ifeq (,$(ROUTDIR))
	ROUTDIR = $(RHOME)
endif

ifeq (yes,$(HAS_RHOST))
	# set remote flags for calling win-cc.sh and ld.sh)
	RFLAGS=--rhome "$(RHOME)" --lhome "$(LHOME)" --rhost "$(RHOST)" --rport $(RPORT) --proxy_tool "$(PROXY_TOOL)" \
 --loutdir "$(OUTDIR)" --routdir "$(ROUTDIR)"
	# RWORKDIR can be redefined by individual makefiles as needed
	RWORKDIR = . 
	RUN_REMOTELY = $(TOP)/build/run_remotely.sh $(PROXY_TOOL) $(RHOST) $(RPORT) $(RHOME) $(LHOME) $(RWORKDIR) $(ROUTDIR) $(OUTDIR)
endif

# determine BITS
BITS = $(shell dpkg-architecture -qDEB_BUILD_ARCH_BITS)