[5ca4ef]: binutils / Makefile Maximize Restore History

Download this file

Makefile    328 lines (296 with data), 9.2 kB

  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
##
# @file Makefile
# Copyright 2013 MinGW.org project
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# This file is part of MinGW Package Maker (mpmkr).
#
# This file is used to make the packages for binutils-2.23.2 MinGW distribution.
include package.ini
PACKAGE = $(PKG)-$(PKGVER)
PKGFILE = $(PACKAGE)$(PKGEXTRA).$(PKGEXT)
MPKG = $(PKG)-$(MPKGVER)-$(MPKGRLS)-$(MPKGRT)
MPKGSRC = $(MPKG)-src.$(MPKGEXT)
MPKGBIN = $(MPKG)-bin.$(MPKGEXT)
MPKGDLL = $(MPKG)-dll.$(MPKGEXT)
MPKGDEV = $(MPKG)-dev.$(MPKGEXT)
MPKGLIC = $(MPKG)-lic.$(MPKGEXT)
MPKGDOC = $(MPKG)-doc.$(MPKGEXT)
MPKGINFO = $(MPKG)-info.$(MPKGEXT)
MPKGMAN = $(MPKG)-man.$(MPKGEXT)
MPKGLANG = $(MPKG)-lang.$(MPKGEXT)
DOCDIR = share/doc/$(PKG)/$(MPKGVER)
LICDIR = share/doc/$(PKG)/$(MPKGVER)
INFODIR = share/info
MANDIR = share/man
LOCALEDIR = share/locale
ifeq (,$(MPATCHOPT))
MPATCHOPT = -p0
endif
INSTALL_DATA = /bin/install -v -m 644
INSTALL_DIR = /bin/install -v -d
INSTALL_BIN = /bin/install -v -m 755
CPALL = /bin/cp -a
MKDIR_P = /bin/mkdir -p
RMF = /bin/rm -f
RMFR = $(RMF)r
RMPKG = $(RMFR) pkg/
MKPKGFILE = cd pkg && /bin/tar acf ../$@ --dereference --hard-dereference *
EXTRACTPKG = /bin/tar axf $(PACKAGE).$(PKGEXT)
TOUCH = /bin/touch $@
RMDIR = /bin/rmdir
MV = /bin/mv
WGET = /bin/wget
PATCH = /bin/patch
LS = /bin/ls
CONFIGURE = cd bld && ../$(PACKAGE)/configure
COMPILE = export LIBRARY_PATH=`pwd`/bld; cd bld && /bin/make
STAGE = $(COMPILE) install prefix=\`pwd\`/../stg
all: usage
prep: $(PKGFILE) exec_prep bld/libdl.a
exec_prep:
$(RMFR) $(PACKAGE)
$(EXTRACTPKG)
$(MKDIR_P) bld
$(TOUCH)
bld/libdl.a:
$(CPALL) /mingw/lib/libm.a bld/libdl.a
$(PKGFILE):
$(RMFR) part
$(MKDIR_P) part
$(WGET) $(PKGURL)/$(PKGFILE) -O part/$(PKGFILE)
$(MV) part/$(PKGFILE) $(PKGFILE)
$(RMDIR) part
patch: prep exec_patch
exec_patch:
ifneq ($(MPATCHES),)
for F in $(MPATCHES); do \
$(PATCH) $(MPATCHOPT) < $$F ; \
done
endif
$(TOUCH)
configure: patch exec_configure
exec_configure:
$(CONFIGURE) $(CONFOPT)
$(TOUCH)
compile: configure exec_compile
exec_compile:
$(COMPILE)
$(TOUCH)
stage: compile exec_stage
exec_stage: stg/share/doc/$(PKG)/$(MPKGVER) stg/lib/libdl.a
$(STAGE)
if test $(COPY_BIN_TO_HOST) = 'y' \
-o $(COPY_BIN_TO_HOST) = 'yes'; then \
for F in stg/bin/*.exe; do \
B=`basename $$F` ; \
$(INSTALL_DATA) $$F stg/bin/$(HOST)-$$B ; \
done ; \
fi
if test $(COPY_LIB_TO_HOST) = 'y' \
-o $(COPY_LIB_TO_HOST) = 'yes'; then \
if test -d stg/include; then \
$(INSTALL_DIR) stg/$(HOST)/include ; \
$(CPALL) stg/include/* stg/$(HOST)/include/ ; \
fi ; \
if test -d stg/lib; then \
$(INSTALL_DIR) stg/$(HOST)/lib ; \
$(CPALL) stg/lib/* stg/$(HOST)/lib/ ; \
$(RMF) stg/lib/*.la ; \
fi ; \
if test -d stg/libexec; then \
$(INSTALL_DIR) stg/$(HOST)/libexec ; \
$(CPALL) stg/libexec/* stg/$(HOST)/libexec/ ; \
fi ; \
fi
$(TOUCH)
ALL_DOC_FILES = $(LIC_FILES) $(DOC_FILES)
stg/share/doc/$(PKG)/$(MPKGVER): stg/share/doc/$(PKG)/$(MPKGVER)/README.$(MPKG)
for F in $(ALL_DOC_FILES); do \
D=`dirname $$F` ; \
$(INSTALL_DIR) $@/$$D ; \
$(INSTALL_DATA) $(PACKAGE)/$$F $@/$$D ; \
done
stg/share/doc/$(PKG)/$(MPKGVER)/README.$(MPKG): README.$(MPKG)
$(INSTALL_DIR) $(@D)
$(INSTALL_DATA) $? $@
stg/lib/libdl.a: bld/libdl.a
$(INSTALL_DIR) $(@D)
$(INSTALL_DATA) $? $@
post_stage: stage exec_post_stage
exec_post_stage:
$(TOUCH)
package: post_stage exec_package
exec_package: rls rls/$(MPKGSRC) rls/$(MPKGDLL) rls/$(MPKGBIN) rls/$(MPKGDEV) rls/$(MPKGLIC) rls/$(MPKGDOC) rls/$(MPKGINFO) rls/$(MPKGMAN) rls/$(MPKGLANG) rls/README.$(MPKG)
$(TOUCH)
rls:
$(RMFR) rls
$(INSTALL_DIR) $@
rls/$(MPKGSRC): $(PKGFILE) Makefile package.ini README.makefile README.$(MPKG) $(MPATCHES)
$(RMPKG)
$(INSTALL_DIR) pkg/$(MPKG)
for F in $^; do \
$(INSTALL_DATA) $$F pkg/$(MPKG)/ ; \
done
$(MKPKGFILE)
rls/$(MPKGBIN):
if test `$(LS) stg/bin/* > /dev/null; echo $$?` = 0; then \
$(RMPKG) ; \
$(INSTALL_DIR) pkg/bin ; \
if test -d stg/$(HOST)/bin; then \
$(INSTALL_DIR) pkg/$(HOST)/bin ; \
$(CPALL) stg/$(HOST)/bin/* pkg/$(HOST)/bin/ ; \
$(RMF) pkg/$(HOST)/bin/*.dll ; \
fi ; \
$(CPALL) stg/bin/* pkg/bin/ ; \
$(RMF) pkg/bin/*.dll ; \
if test `$(LS) pkg/bin/* > /dev/null; echo $$?` = 0; then \
$(MKPKGFILE) ; \
fi ; \
fi
rls/$(MPKGDLL):
if test `$(LS) stg/bin/*.dll > /dev/null; echo $$?` = 0; then \
$(RMPKG) ; \
$(INSTALL_DIR) pkg/bin ; \
$(CPALL) stg/bin/*.dll pkg/bin/ ; \
$(MKPKGFILE) ; \
fi
rls/$(MPKGDEV):
$(eval NEED_TO_MAKE = 0)
if test -d stg/include -o -d stg/lib -o -d std/libexec; then \
$(RMPKG) ; \
if test -d stg/include; then \
$(INSTALL_DIR) pkg/include ; \
$(CPALL) stg/include/* pkg/include/ ; \
$(eval NEED_TO_MAKE = 1) \
fi ; \
if test -d stg/lib; then \
$(INSTALL_DIR) pkg/lib ; \
$(CPALL) stg/lib/* pkg/lib/ ; \
$(RMF) pkg/lib/*.la ; \
$(eval NEED_TO_MAKE = 1) \
fi ; \
if test -d stg/libexec; then \
$(INSTALL_DIR) pkg/libexec ; \
$(CPALL) stg/libexec/* pkg/libexec/ ; \
$(eval NEED_TO_MAKE = 1) \
fi ; \
fi
if test -d stg/$(HOST)/include \
-o -d stg/$(HOST)/lib \
-o -d std/$(HOST)/libexec; then \
if test -d stg/include; then \
$(INSTALL_DIR) pkg/$(HOST)/include ; \
$(CPALL) stg/$(HOST)/include/* pkg/$(HOST)/include/ ; \
$(eval NEED_TO_MAKE = 1) \
fi ; \
if test -d stg/lib; then \
$(INSTALL_DIR) pkg/$(HOST)/lib ; \
$(CPALL) stg/$(HOST)/lib/* pkg/$(HOST)/lib/ ; \
$(RMF) pkg/$(HOST)/lib/*.la ; \
$(eval NEED_TO_MAKE = 1) \
fi ; \
if test -d stg/libexec; then \
$(INSTALL_DIR) pkg/$(HOST)/libexec ; \
$(CPALL) stg/$(HOST)/libexec/* pkg/$(HOST)/libexec/ ; \
$(eval NEED_TO_MAKE = 1) \
fi ; \
fi
if test $(NEED_TO_MAKE) = 1; then \
$(MKPKGFILE) ; \
fi
rls/$(MPKGLIC):
if test ! -z "$(LIC_FILES)"; then \
$(RMPKG) ; \
for F in $(LIC_FILES); do \
D=`dirname $$F` ; \
$(INSTALL_DIR) pkg/$(LICDIR)/$$D ; \
$(INSTALL_DATA) stg/$(LICDIR)/$$F pkg/$(LICDIR)/$$D ; \
done ; \
$(MKPKGFILE) ; \
fi
rls/$(MPKGDOC):
if test ! -z "$(DOC_FILES)"; then \
$(RMPKG) ; \
for F in $(DOC_FILES) README.$(MPKG); do \
D=`dirname $$F` ; \
$(INSTALL_DIR) pkg/$(DOCDIR)/$$D ; \
$(INSTALL_DATA) stg/$(DOCDIR)/$$F pkg/$(DOCDIR)/$$D ; \
done ; \
$(MKPKGFILE) ; \
fi
rls/$(MPKGINFO):
if test -d stg/$(INFODIR); then \
$(RMPKG) ; \
$(INSTALL_DIR) pkg/$(INFODIR) ; \
$(CPALL) stg/$(INFODIR)/* pkg/$(INFODIR)/ ; \
$(RMF) pkg/$(INFODIR)/dir ; \
$(MKPKGFILE) ; \
fi
rls/$(MPKGMAN):
if test -d stg/$(MANDIR); then \
$(RMPKG) ; \
$(INSTALL_DIR) pkg/$(MANDIR) ; \
$(CPALL) stg/$(MANDIR)/* pkg/$(MANDIR) ; \
$(MKPKGFILE) ; \
fi
rls/$(MPKGLANG):
if test -d stg/$(LOCALEDIR); then \
$(RMPKG) ; \
$(INSTALL_DIR) pkg/$(LOCALEDIR) ; \
$(CPALL) stg/$(LOCALEDIR)/* pkg/$(LOCALEDIR)/ ; \
$(MKPKGFILE) ; \
fi
rls/README.$(MPKG):
$(INSTALL_DATA) README.$(MPKG) rls/
clean:
$(RMFR) $(PACKAGE)
$(RMFR) stg
$(RMFR) rls
$(RMFR) pkg
$(RMFR) bld
$(RMFR) part
$(RMF) exec_*
$(RMF) *.log
check: compile exec_check
exec_check:
cd bld/tests ; \
make -k -j1 check 2>&1 | tee ../check.log
$(TOUCH)
install: compile stage
$(INSTALL_DIR) $(PREFIX)
$(CPALL) stg/* $(PREFIX)/
usage:
@echo To use this make file do the following steps:
@echo make prep : Unpacks the original sources.
@echo make patch : Apply custom patches if there are any.
@echo make configure: Runs the configure script.
@echo make compile: Executes make.
@echo make stage: Installs into a staging area.
@echo make post_stage: Miscellaneous actions performed to the stage area.
@echo make package: Packages the build results including the source.
@echo make clean: Cleans the workspace in order to rebuild the package
@echo make check: Runs self-tests.
@echo make install: Installs the package into the configured directory.
@echo
@echo If you execute \"make clean package\" all of the steps except
@echo the \"make check\" and \"make install\" steps should be executed
@echo in order.