Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile.in « mingw « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8914f101081034cbcf469e2441b90cdc84f9a59a (plain)
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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
# Makefile.in for the winsup/mingw directory.
# Copyright (c) 1995-2008, 1996, 1997, 1998 Cygnus Solutions

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# This makefile requires GNU make.

PACKAGE = @PACKAGE_TARNAME@
VERSION = @PACKAGE_VERSION@
CYGRELEASE = 1

VPATH = @srcdir@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@

# FIXME: I see no reason to define `objdir';
# it appears to be unused, and could be removed.
objdir = .

host_alias = @host_alias@
build_alias = @build_alias@
target_alias = @target_alias@
with_cross_host = @with_cross_host@
prefix = @prefix@
conf_prefix = @prefix@
host_os = @host_os@

datarootdir = @datarootdir@
program_transform_name = @program_transform_name@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@

ifneq (,$(findstring cygwin,$(target_alias)))
# 
# FIXME: What is the purpose of such logic, testing `target_alias'?
#
# Firstly, there is no code generator being built here.  The concept
# of `target' is meaningless, and there is no valid reason to expect
# that `target_alias' would be anything other than an empty string.
# Thus, the validity of such tests is extremely suspect.
#
# Secondly, the decisions being taken, on the basis of these tests,
# rightfully belong in the configure script; all this logic should be
# removed, and properly implemented in `configure.in'.
#
mandir = $(prefix)/share/man
mansection = mingw
else
mandir = @mandir@
mansection = 3
endif
manpage_transform = @mingw_manpage_transform@
ifeq ($(target_alias),$(host_alias))
ifeq ($(build_alias),$(host_alias))
tooldir:=$(exec_prefix)
else
tooldir:=$(exec_prefix)/$(target_alias)
endif
else
tooldir:=$(exec_prefix)/$(target_alias)
endif
datadir = @datadir@
infodir = @infodir@
includedir = @includedir@
ifneq (,$(findstring cygwin,$(target_alias)))
#
# FIXME: Doubtful use of `target_alias', again.
#
# Here we not only have a dubious test, based on `target_alias',
# but we also assign local alternatives for the standard autoconf
# installation path macros.  This should not be necessary; the
# configure script should simply assign appropriate values to
# the standard macros, which should be used herein.
#
inst_bindir:=$(tooldir)/bin
inst_includedir:=$(tooldir)/include/mingw
inst_libdir:=$(tooldir)/lib/mingw
inst_docdir:=$(tooldir)/share/doc/mingw-runtime
need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
else
ifneq (,$(with_cross_host))
#
# FIXME: What is the intended purpose of `with_cross_host'?
#
# Notwithstanding that this conforms to no known standard, and
# is completely undocumented, it does not belong here; every one
# of these settings is the prerogative of the configure script,
# and they should use standard names, as noted above.
#
inst_bindir:=$(tooldir)/bin
inst_includedir:=$(tooldir)/include
inst_libdir:=$(tooldir)/lib
inst_docdir:=$(tooldir)/share/doc/mingw-runtime
need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
else
inst_bindir:=$(bindir)
inst_includedir:=$(includedir)
inst_libdir:=$(libdir)
inst_docdir:=$(prefix)/doc/runtime
need-DESTDIR-compatibility = prefix bindir includedir libdir mandir
endif
endif

# The Mingw headers are installed under a subdirectory of
# $(tooldir)/include when configuring in Cygwin.
HEADER_SUBDIR = @HEADER_SUBDIR@

SHELL = /bin/sh

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
mkinstalldirs = $(SHELL) @MKINSTALLDIRS@

CC := @CC@
ifneq (,$(findstring cygwin,$(target_alias)))
#
# FIXME: What is the purpose of this hideous kludge?
#
# Again, we have a dubious use of `target_alias'.  Worse, `CC'
# should have been appropriately set by the configure script; to
# mess with it, in this fashion, should neither be necessary,
# nor accepted.
#
override CC := ${filter-out -L% -B%,${shell echo $(CC) | sed -e 's%\(-isystem\|-iwithprefixbefore\)  *[^ ]*\( \|$$\)% %g'}}
endif
# FIXME: Which is it, CC or CC_FOR_TARGET?
CC_FOR_TARGET = $(CC)
AS_FOR_TARGET = $(AS)
CFLAGS = @CFLAGS@
CXXFLAGS = @CXXFLAGS@

# compiling with Cygwin?
NO_CYGWIN := @NO_CYGWIN@
ifdef NO_CYGWIN
#
# FIXME: Again, this should have been resolved by `configure',
# and this kludge should be unnecessary.
#
override CC := ${NO_CYGWIN} $(firstword ${CC})
endif

# Either crtdll (CRT_ID 1) or msvcrt (CRT_ID 2).
RUNTIME = @RUNTIME@
CRT_ID = @CRT_ID@

# Needed for threading dll.
THREAD_DLL = @THREAD_DLL@
THREAD_DLL_VERSION = 10
THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_DLL_VERSION).dll

# Various libraries.
LIBM_A=@LIBM_A@

W32API_INCLUDE = @W32API_INCLUDE@
INCLUDES = -I$(srcdir)/include \
  -I$(srcdir)/../include \
  -nostdinc \
  -iwithprefixbefore include
ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(W32API_INCLUDE)
ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) -nostdinc++ $(W32API_INCLUDE)

AS = @AS@
AR = @AR@
LD = @LD@
AR_FLAGS = rcv
RANLIB = @RANLIB@
DLLTOOL = @DLLTOOL@
DLLTOOLFLAGS =
DLLTOOL_FOR_TARGET = $(DLLTOOL)
DLLTOOL_FLAGS = --as $(AS_FOR_TARGET)
DLLWRAP = @DLLWRAP@
DLLWRAP_FOR_TARGET = $(DLLWRAP)
DLLWRAP_FLAGS = --dlltool $(DLLTOOL) --as $(AS) --driver-name $(CC)
OBJCOPY = @OBJCOPY@
NM = @NM@

TAR = tar
TARFLAGS = z
TARFILEEXT = .tar.gz

SUBDIRS = mingwex profile

# FIXME: Most of these are either redundant, or should be set
# directly in the subdirectories' Makefiles, by `configure'.
FLAGS_TO_PASS:=\
	AS="$(AS)" \
	CC="$(CC)" \
	CFLAGS="$(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG)" \
	CXXFLAGS="$(CXXFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG)" \
	EXE_LDFLAGS="$(EXE_LDFLAGS)" \
	AR="$(AR)" \
	RANLIB="$(RANLIB)" \
	LD="$(LD)" \
	DLLTOOL="$(DLLTOOL)" \
	exec_prefix="$(exec_prefix)" \
	bindir="$(bindir)" \
	libdir="$(libdir)" \
	tooldir="$(tooldir)" \
	datadir="$(datadir)" \
	infodir="$(infodir)" \
	includedir="$(includedir)" \
	inst_bindir="$(inst_bindir)" \
	inst_includedir="$(inst_includedir)" \
	inst_libdir="$(inst_libdir)" \
	inst_docdir="$(inst_docdir)" \
	prefix="$(prefix)" \
	target_alias="$(target_alias)" \
	TAR="$(TAR)" \
	TARFLAGS="$(TARFLAGS)" \
	TARFILEEXT="$(TARFILEEXT)"

CRT0S = crt1.o dllcrt1.o crt2.o dllcrt2.o CRT_noglob.o crtmt.o crtst.o \
	CRT_fp8.o CRT_fp10.o txtmode.o binmode.o
MINGW_OBJS = CRTglob.o CRTfmode.o CRTinit.o  dllmain.o gccmain.o \
	     main.o crtst.o CRT_fp10.o txtmode.o \
	     pseudo-reloc.o pseudo-reloc-list.o cpu_features.o \
	     tlsmcrt.o tlsmthread.o tlssup.o tlsthrd.o

MOLD_OBJS = isascii.o iscsym.o iscsymf.o toascii.o \
	strcasecmp.o strncasecmp.o wcscmpi.o

LIBS = libcrtdll.a \
       libmsvcrt.a  libmsvcrtd.a \
       libmsvcr70.a libmsvcr70d.a \
       libmsvcr71.a libmsvcr71d.a \
       libmsvcr80.a libmsvcr80d.a \
       libmsvcr90.a libmsvcr90d.a \
       libmingw32.a \
       libcoldname.a \
       libmoldname.a   libmoldnamed.a \
       libmoldname70.a libmoldname70d.a \
       libmoldname71.a libmoldname71d.a \
       libmoldname80.a libmoldname80d.a \
       libmoldname90.a libmoldname90d.a \
       $(LIBM_A) \
       libmingwthrd_old.a \
       libmingwthrd.a

DLLS = $(THREAD_DLL_NAME)

INSTDOCS = CONTRIBUTORS \
	   DISCLAIMER \
	   README

SRCDIST_FILES = CRT_noglob.c CRTfmode.c CRTglob.c CRTinit.c ChangeLog \
Makefile.in README TODO config.guess config.sub configure configure.in \
aclocal.m4 crt1.c crtdll.def crtmt.c crtst.c  dllcrt1.c dllmain.c \
gccmain.c init.c install-sh jamfile main.c mkinstalldirs \
moldname.def.in msvcrt.def.in ofmt_stub.s \
mthr.c mthr_init.c tlsmcrt.c tlsmthread.c tlssup.c tlsthrd.c readme.txt \
isascii.c iscsym.c iscsymf.c toascii.c \
strcasecmp.c strncasecmp.c wcscmpi.c \
CRT_fp8.c CRT_fp10.c test_headers.c txtmode.c binmode.c pseudo-reloc.c \
pseudo-reloc-list.c cpu_features.c cpu_features.h \
DISCLAIMER CONTRIBUTORS


all_dlls_host = @all_dlls_host@
install_dlls_host = @install_dlls_host@

all: $(CRT0S) $(LIBS) $(all_dlls_host)

all_dlls_host: $(DLLS)

install_dlls_host:
	for i in $(DLLS); do \
		$(INSTALL_PROGRAM) $$i $(DESTDIR)$(inst_bindir)/$$i ; \
	done

_libm_dummy.o:
	rm -f _libm_dummy.c
	echo "static int __mingw_libm_dummy;" > _libm_dummy.c
	$(CC) -c $(ALL_CFLAGS) _libm_dummy.c
	rm -f _libm_dummy.c

libm.a: _libm_dummy.o
	$(AR) rc $@ _libm_dummy.o
	$(RANLIB) $@

libmingwthrd.a: crtmt.o
	$(AR) $(ARFLAGS) $@ crtmt.o
	$(RANLIB) $@

libmingwthrd_old.a: crtmt.o mingwthrd.def
	$(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(THREAD_DLL_NAME) \
	  --def mingwthrd.def --output-lib $@
	$(AR) $(ARFLAGS) $@ crtmt.o
	$(RANLIB) $@

DLL_OFILES        = mthr.o mthr_init.o
DLL_CC_STUFF      = -B./ -shared $(MNO_CYGWIN) -Wl,--image-base,0x6FBC0000 \
		    -Wl,--entry,_DllMainCRTStartup@12 \
                    $(DLL_OFILES) mingwthrd.def \
		    -Lmingwex

$(THREAD_DLL_NAME) mingwthrd.def: $(DLL_OFILES) Makefile $(SUBDIRS)
	$(DLLTOOL) --as $(AS) --output-def mingwthrd.def $(DLL_OFILES)
	$(CC) $(DLL_CC_STUFF) -o $(THREAD_DLL_NAME)

libmingw32.a: $(MINGW_OBJS)
	$(AR) rc $@ $(MINGW_OBJS)
	$(RANLIB) $@

msvcrt.def  msvcrtd.def \
msvcr70.def msvcr70d.def \
msvcr71.def msvcr71d.def \
msvcr80.def msvcr80d.def \
msvcr90.def msvcr90d.def: msvcrt.def.in
	V=`echo $@ | sed -e 's|[a-z]*\([0-9]*\).*|\1|'`; \
	test -z "$$V" && V=60; \
	V="0x0$${V}0"; \
	$(CC) -DRUNTIME=$(basename $(notdir $@)) \
		-D__MSVCRT_VERSION__=$$V \
		-D__$(basename $(notdir $@))__=1 \
		-D__MSVCRT__ -C -E -P \
		-xc-header $? > $@

moldname-crtdll.def: moldname.def.in
	$(CC) -DRUNTIME=crtdll \
		-D__FILENAME__=moldname-crtdll.def \
		-D__CRTDLL__  -C -E -P \
		-xc-header $? > $@

moldname-msvcrt.def: moldname.def.in
	$(CC) -DRUNTIME=msvcrt \
		-D__FILENAME__=moldname-msvcrt.def \
		-D__MSVCRT__  -C -E -P \
		-xc-header $? > $@

libcoldname.a: moldname-crtdll.def $(MOLD_OBJS)
	$(DLLTOOL) --as $(AS) -k -U	\
		--dllname crtdll.dll	\
		--def moldname-crtdll.def	\
		--output-lib $@
	$(AR) rc $@ $(MOLD_OBJS)
	$(RANLIB) $@

libmoldname.a libmoldnamed.a: moldname-msvcrt.def $(MOLD_OBJS)
	$(DLLTOOL) --as $(AS) -k -U	\
		--dllname msvcrt$(@:libmoldname%a=%)dll \
		--def moldname-msvcrt.def	\
		--output-lib $@
	$(AR) rc $@ $(MOLD_OBJS)
	$(RANLIB) $@

libmoldname70.a libmoldname70d.a \
libmoldname71.a libmoldname71d.a \
libmoldname80.a libmoldname80d.a \
libmoldname90.a libmoldname90d.a: moldname-msvcrt.def $(MOLD_OBJS)
	$(DLLTOOL) --as $(AS) -k -U	\
		--dllname msvcr$(@:libmoldname%a=%)dll  \
		--def moldname-msvcrt.def	\
		--output-lib $@
	$(AR) rc $@ $(MOLD_OBJS)
	$(RANLIB) $@

# These special rules are necessary...
#
crt1.o dllcrt1.o:
	$(CC) -c -D__CRTDLL__ -U__MSVCRT__ $(ALL_CFLAGS) $< -o $@

crt2.o dllcrt2.o:
	$(CC) -c -D__MSVCRT__ -U__CRTDLL__ $(ALL_CFLAGS) $< -o $@

check: check-headers

TEST_H_OPTIONS = $(ALL_CFLAGS) -Wall -W -Wsystem-headers -c \
	$(srcdir)/test_headers.c -o test_headers.o

.PHONY: check-headers
check-headers: force
	@echo "Testing runtime headers..."
	@for lang in c c++ objective-c ; do \
		echo "$$lang ..."; \
		$(CC) -x$$lang  $(TEST_H_OPTIONS) ; \
		echo "$$lang -ansi"; \
		$(CC) -x$$lang -ansi $(TEST_H_OPTIONS) ; \
	done
	@echo; echo "Testing runtime 8.0 headers..."
	@for lang in c c++ objective-c ; do \
		echo "$$lang ..."; \
		$(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 $(TEST_H_OPTIONS) ; \
		echo "$$lang -ansi"; \
		$(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 -ansi $(TEST_H_OPTIONS) ; \
	done
	@echo; echo "Testing runtime 8.0(time32) headers..."
	@for lang in c c++ objective-c ; do \
		echo "$$lang ..."; \
		$(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 -D_USE_32BIT_TIME_T $(TEST_H_OPTIONS) ; \
		echo "$$lang -ansi"; \
		$(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 -D_USE_32BIT_TIME_T -ansi $(TEST_H_OPTIONS) ; \
	done
	@echo; echo "Testing runtime 8.0(time32) headers..."
# specify -std=xx only for C
	@for std in gnu89 gnu99 c89 c99 ; do \
		echo "std = $$std"; \
		$(CC) -std=$$std  $(TEST_H_OPTIONS) ; \
	done

	@rm -f test_headers.o

clean:
	-rm -f *.o *.a *~ core a.out mingwthrd.def mingwthrd.base mingwthrd.exp
	-rm -f $(THREAD_DLL_NAME) mingwthrd_dummy.exe
	-rm -f msvcr*.def moldname-*.def
	@$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)

distclean: clean
	@$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
	-rm -f config.cache config.status config.log
	-rm -f Makefile

ifdef SNAPDATE
      distdir=$(PACKAGE)-$(VERSION)-$(SNAPDATE)
else
   ifneq (,$(findstring cygwin, $(target_alias)))
      distdir=$(PACKAGE)-$(VERSION)-$(CYGRELEASE)
   else
      distdir=$(PACKAGE)-$(VERSION)-$(host_os)
   endif
endif

ifneq (,$(findstring cygwin, $(target_alias)))
#
# FIXME: Dubious use of `target_alias', yet again.
#
# Once more, the default settings for these macros could be
# more productively determined by `configure'.
#
  TARFLAGS = j
  TARFILEEXT = .tar.bz2
  dist_prefix = $(conf_prefix)
endif

dist: srcdist bindist

srcdist:
	rm -rf $(distdir)
	mkdir $(distdir)
	chmod 755 $(distdir)
	for i in $(SRCDIST_FILES); do \
		cp -p $(srcdir)/$$i $(distdir)/$$i ; \
	done
	for i in $(SUBDIRS); do \
		(cd $$i; $(MAKE) distdir=../$(distdir) dist); \
	done
#FIXME this needs to be done with SUBDIRS and Makefiles.
#
#  Maybe, but this is simpler, and adequate for now!
#  However, as more manpages are added, spanning multiple sections,
#  we'll probably need a separate Makefile to organise them.
#
	mkdir $(distdir)/include
	mkdir $(distdir)/include/sys
	cp $(srcdir)/include/*.h $(distdir)/include/
	cp $(srcdir)/include/sys/*.h $(distdir)/include/sys/
	mkdir $(distdir)/man
	cp $(srcdir)/man/*.man $(distdir)/man/
#
#end FIXME
	rm -f $(distdir)-src.tar.gz
	$(TAR) $(TARFLAGS)cf $(distdir)-src$(TARFILEEXT) $(distdir)

# Binary package structure is determined according to the
# preferred package name assigned at configure time...
#
bindist: bindist-$(PACKAGE)

# The directory structure is common to both package styles...
#
bindist-common:
	rm -rf $(distdir)
	mkdir $(distdir)
	chmod 755 $(distdir)
	$(MAKE) install prefix=$(shell pwd)/$(distdir)$(dist_prefix)
	rm -f $(distdir).tar.gz

# Current MinGW distributions prefer separate `dev' and `dll' bundles,
# and use the abbreviated `mingwrt' form for the package name...
#
DEVDIST_FILES = * --exclude=bin
DLLDIST_FILES = bin/*.dll doc/*
#
bindist-mingwrt: bindist-common
	cd $(distdir); \
	$(TAR) $(TARFLAGS)cf ../$(distdir)-dev$(TARFILEEXT) $(DEVDIST_FILES); \
	$(TAR) $(TARFLAGS)cf ../$(distdir)-dll$(TARFILEEXT) $(DLLDIST_FILES)
	rm -rf $(distdir)

# However, Cygwin maintainers continue to prefer a composite package,
# retaining the older `mingw-runtime' naming convention...
#
BINDIST_FILES = *
#
bindist-mingw-runtime: bindist-common
	cd $(distdir); \
	$(TAR) $(TARFLAGS)cf ../$(distdir)$(TARFILEEXT) $(BINDIST_FILES)
	rm -rf $(distdir)

snapshot:
	make dist SNAPDATE=$(shell date '+%Y%m%d')

info:

info-html:

install-info: info

.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility

$(need-DESTDIR-compatibility):
	@test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
	  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
	esac

fail-DESTDIR-compatibility:
	$(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
	try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)

install-dirs: $(need-DESTDIR-compatibility)
	$(mkinstalldirs) $(DESTDIR)$(inst_bindir)
	$(mkinstalldirs) $(DESTDIR)$(inst_includedir)
	$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
	$(mkinstalldirs) $(DESTDIR)$(inst_docdir)
	$(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)

install: all install-dirs $(install_dlls_host)
	for i in $(LIBS); do \
		$(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
	done
	for i in $(CRT0S); do \
		$(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
	done
	for i in $(INSTDOCS); do \
		$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(inst_docdir)/$$i ; \
	done
	for sub in . sys ; do \
		dstdir=$(DESTDIR)$(inst_includedir)/$$sub ; \
		$(mkinstalldirs) $$dstdir ; \
		for i in $(srcdir)/include/$$sub/*.h ; do \
		  $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
		done ; \
	done
#
# This provisional hack installs the only manpage we have at present...
# It simply CANNOT suffice, when we have more manpages to ship.
#
	$(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
	$(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
	  echo dirname.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
	$(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
	  echo basename.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
#
# End provisional hack.
#
	@$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)

subdirs: $(SUBDIRS)
$(SUBDIRS): force
	@test -n "$(DO)" && g="$(DO)" || g=all; echo "Making \`$$g' in \`$@'"
	@cd $@; $(MAKE) $(FLAGS_TO_PASS) $(DO)

force:

#
# Dependencies
#
libcrtdll.a: crtdll.def
libmsvcrt.a: msvcrt.def
libmsvcrtd.a: msvcrtd.def
CRT_noglob.o: CRT_noglob.c
CRTfmode.o: CRTfmode.c
CRTglob.o: CRTglob.c
CRTinit.o: CRTinit.c
crt1.o: crt1.c init.c
crt2.o: crt1.c init.c
crtmt.o: crtmt.c
crtst.o: crtst.c
ctype_old.o: ctype_old.c
dllcrt1.o: dllcrt1.c
dllcrt2.o: dllcrt1.c
dllmain.o: dllmain.c
main.o: main.c
oldnames.o: oldnames.c
string_old.o: string_old.c
CRT_fp8.o: CRT_fp8.c
CRT_fp10.o: CRT_fp10.c


Makefile: Makefile.in config.status configure
	$(SHELL) config.status

config.status: configure
	$(SHELL) config.status --recheck

.SUFFIXES: .y $(SUFFIXES) .cc .def .a

sym_prefix = __msvcrt

NM_LOOKUP = $(NM) $@ | sed -n \
  -e '/:$$/h;/^[0-7][0-7]*  *T  */{s///;H;g;s/\n//p' \
  -e '}' | sed -n 's/:_'"$$key"'$$//p'

MINGW_REPL_FUNCS = printf fprintf sprintf vprintf vfprintf vsprintf

lib%.a: %.def
	$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@ --def $<
	for key in $(MINGW_REPL_FUNCS); do \
	  src=`$(NM_LOOKUP)`; \
	  if test -n "$$src"; then \
	    dst=`echo "$$src" | sed 's/0/4/'`; repl="$$repl $$dst"; \
	    tmpfiles="$$tmpfiles $$src $$dst"; \
	    $(AR) x $@ $$src; \
	    $(OBJCOPY) --redefine-sym _$$key=_$(sym_prefix)_$$key \
	      --redefine-sym __imp__$$key=__imp__$(sym_prefix)_$$key \
	      $$src $$dst; \
	  fi; done; \
	test `key=_get_output_format; $(NM_LOOKUP)` || \
	  repl="$$repl ofmt_stub.o"; \
	test -n "$$repl" && $(AR) rcs $@ $$repl; \
	$(RM) $$tmpfiles

libmsvcrt.a  libmsvcrtd.a:  ofmt_stub.o
libmsvcr70.a libmsvcr70d.a: ofmt_stub.o
libmsvcr71.a libmsvcr71d.a: ofmt_stub.o
libcrtdll.a  libcrtdlld.a:  ofmt_stub.o

.c.o:
	$(CC) -c $(ALL_CFLAGS) $< -o $@

# $RCSfile$: end of file