OSDN Git Service

c0429e4b2f759c0448f33136956f001ba7c6bfa2
[mingw/mingw-org-wsl.git] / mingwrt / Makefile.in
1 # Makefile.in for the winsup/mingw directory.
2 # Copyright (c) 1995-2008, 1996, 1997, 1998 Cygnus Solutions
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 # This makefile requires GNU make.
19
20 PACKAGE = @PACKAGE_TARNAME@
21 VERSION = @PACKAGE_VERSION@
22 CYGRELEASE = 1
23
24 VPATH = @srcdir@
25 srcdir = @srcdir@
26 top_srcdir = @top_srcdir@
27 top_builddir = @top_builddir@
28
29 # FIXME: I see no reason to define `objdir';
30 # it appears to be unused, and could be removed.
31 objdir = .
32
33 host_alias = @host_alias@
34 build_alias = @build_alias@
35 target_alias = @target_alias@
36 with_cross_host = @with_cross_host@
37 prefix = @prefix@
38 conf_prefix = @prefix@
39 host_os = @host_os@
40
41 datarootdir = @datarootdir@
42 program_transform_name = @program_transform_name@
43 exec_prefix = @exec_prefix@
44 bindir = @bindir@
45 libdir = @libdir@
46
47 ifneq (,$(findstring cygwin,$(target_alias)))
48 #
49 # FIXME: What is the purpose of such logic, testing `target_alias'?
50 #
51 # Firstly, there is no code generator being built here.  The concept
52 # of `target' is meaningless, and there is no valid reason to expect
53 # that `target_alias' would be anything other than an empty string.
54 # Thus, the validity of such tests is extremely suspect.
55 #
56 # Secondly, the decisions being taken, on the basis of these tests,
57 # rightfully belong in the configure script; all this logic should be
58 # removed, and properly implemented in `configure.in'.
59 #
60 mandir = $(prefix)/share/man
61 mansection = mingw
62 else
63 mandir = @mandir@
64 mansection = 3
65 endif
66 manpage_transform = @mingw_manpage_transform@
67 ifeq ($(target_alias),$(host_alias))
68 ifeq ($(build_alias),$(host_alias))
69 tooldir:=$(exec_prefix)
70 else
71 tooldir:=$(exec_prefix)/$(target_alias)
72 endif
73 else
74 tooldir:=$(exec_prefix)/$(target_alias)
75 endif
76 datadir = @datadir@
77 infodir = @infodir@
78 includedir = @includedir@
79 ifneq (,$(findstring cygwin,$(target_alias)))
80 #
81 # FIXME: Doubtful use of `target_alias', again.
82 #
83 # Here we not only have a dubious test, based on `target_alias',
84 # but we also assign local alternatives for the standard autoconf
85 # installation path macros.  This should not be necessary; the
86 # configure script should simply assign appropriate values to
87 # the standard macros, which should be used herein.
88 #
89 inst_bindir:=$(tooldir)/bin
90 inst_includedir:=$(tooldir)/include/mingw
91 inst_libdir:=$(tooldir)/lib/mingw
92 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
93 need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
94 else
95 ifneq (,$(with_cross_host))
96 #
97 # FIXME: What is the intended purpose of `with_cross_host'?
98 #
99 # Notwithstanding that this conforms to no known standard, and
100 # is completely undocumented, it does not belong here; every one
101 # of these settings is the prerogative of the configure script,
102 # and they should use standard names, as noted above.
103 #
104 inst_bindir:=$(tooldir)/bin
105 inst_includedir:=$(tooldir)/include
106 inst_libdir:=$(tooldir)/lib
107 inst_docdir:=$(tooldir)/share/doc/mingw-runtime
108 need-DESTDIR-compatibility = prefix exec_prefix tooldir mandir
109 else
110 inst_bindir:=$(bindir)
111 inst_includedir:=$(includedir)
112 inst_libdir:=$(libdir)
113 inst_docdir:=$(prefix)/doc/runtime
114 need-DESTDIR-compatibility = prefix bindir includedir libdir mandir
115 endif
116 endif
117
118 # The Mingw headers are installed under a subdirectory of
119 # $(tooldir)/include when configuring in Cygwin.
120 HEADER_SUBDIR = @HEADER_SUBDIR@
121
122 SHELL = /bin/sh
123
124 INSTALL = @INSTALL@
125 INSTALL_DATA = @INSTALL_DATA@
126 INSTALL_PROGRAM = @INSTALL_PROGRAM@
127 mkinstalldirs = $(SHELL) @MKINSTALLDIRS@
128
129 CC := @CC@
130 ifneq (,$(findstring cygwin,$(target_alias)))
131 #
132 # FIXME: What is the purpose of this hideous kludge?
133 #
134 # Again, we have a dubious use of `target_alias'.  Worse, `CC'
135 # should have been appropriately set by the configure script; to
136 # mess with it, in this fashion, should neither be necessary,
137 # nor accepted.
138 #
139 override CC := ${filter-out -L% -B%,${shell echo $(CC) | sed -e 's%\(-isystem\|-iwithprefixbefore\)  *[^ ]*\( \|$$\)% %g'}}
140 endif
141 # FIXME: Which is it, CC or CC_FOR_TARGET?
142 CC_FOR_TARGET = $(CC)
143 AS_FOR_TARGET = $(AS)
144 CFLAGS = @CFLAGS@
145 CXXFLAGS = @CXXFLAGS@
146
147 # compiling with Cygwin?
148 NO_CYGWIN := @NO_CYGWIN@
149 ifdef NO_CYGWIN
150 #
151 # FIXME: Again, this should have been resolved by `configure',
152 # and this kludge should be unnecessary.
153 #
154 override CC := ${NO_CYGWIN} $(firstword ${CC})
155 endif
156
157 # Either crtdll (CRT_ID 1) or msvcrt (CRT_ID 2).
158 RUNTIME = @RUNTIME@
159 CRT_ID = @CRT_ID@
160
161 # Needed for threading dll.
162 THREAD_DLL = @THREAD_DLL@
163 THREAD_DLL_VERSION = 10
164 THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_DLL_VERSION).dll
165
166 # Various libraries.
167 LIBM_A=@LIBM_A@
168
169 W32API_INCLUDE = @W32API_INCLUDE@
170 INCLUDES = -I$(srcdir)/include \
171   -I$(srcdir)/../include \
172   -nostdinc \
173   -iwithprefixbefore include
174 ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(W32API_INCLUDE)
175 ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) -nostdinc++ $(W32API_INCLUDE)
176
177 AS = @AS@
178 AR = @AR@
179 LD = @LD@
180 AR_FLAGS = rcv
181 RANLIB = @RANLIB@
182 DLLTOOL = @DLLTOOL@
183 DLLTOOLFLAGS =
184 DLLTOOL_FOR_TARGET = $(DLLTOOL)
185 DLLTOOL_FLAGS = --as $(AS_FOR_TARGET)
186 DLLWRAP = @DLLWRAP@
187 DLLWRAP_FOR_TARGET = $(DLLWRAP)
188 DLLWRAP_FLAGS = --dlltool $(DLLTOOL) --as $(AS) --driver-name $(CC)
189 OBJCOPY = @OBJCOPY@
190 NM = @NM@
191
192 TAR = tar
193 TARFLAGS = z
194 TARFILEEXT = .tar.gz
195
196 SUBDIRS = mingwex profile
197
198 # FIXME: Most of these are either redundant, or should be set
199 # directly in the subdirectories' Makefiles, by `configure'.
200 FLAGS_TO_PASS:=\
201         AS="$(AS)" \
202         CC="$(CC)" \
203         CFLAGS="$(CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG)" \
204         CXXFLAGS="$(CXXFLAGS) $(CFLAGS_COMMON) $(CFLAGS_CONFIG)" \
205         EXE_LDFLAGS="$(EXE_LDFLAGS)" \
206         AR="$(AR)" \
207         RANLIB="$(RANLIB)" \
208         LD="$(LD)" \
209         DLLTOOL="$(DLLTOOL)" \
210         exec_prefix="$(exec_prefix)" \
211         bindir="$(bindir)" \
212         libdir="$(libdir)" \
213         tooldir="$(tooldir)" \
214         datadir="$(datadir)" \
215         infodir="$(infodir)" \
216         includedir="$(includedir)" \
217         inst_bindir="$(inst_bindir)" \
218         inst_includedir="$(inst_includedir)" \
219         inst_libdir="$(inst_libdir)" \
220         inst_docdir="$(inst_docdir)" \
221         prefix="$(prefix)" \
222         target_alias="$(target_alias)" \
223         TAR="$(TAR)" \
224         TARFLAGS="$(TARFLAGS)" \
225         TARFILEEXT="$(TARFILEEXT)"
226
227 CRT0S = crt1.o dllcrt1.o crt2.o dllcrt2.o CRT_noglob.o crtmt.o crtst.o \
228         CRT_fp8.o CRT_fp10.o txtmode.o binmode.o
229 MINGW_OBJS = CRTglob.o CRTfmode.o CRTinit.o  dllmain.o gccmain.o \
230              main.o crtst.o CRT_fp10.o txtmode.o \
231              pseudo-reloc.o pseudo-reloc-list.o cpu_features.o \
232              tlsmcrt.o tlsmthread.o tlssup.o tlsthrd.o
233
234 MOLD_OBJS = isascii.o iscsym.o iscsymf.o toascii.o \
235         strcasecmp.o strncasecmp.o wcscmpi.o
236
237 LIBS = libcrtdll.a \
238        libmsvcrt.a  libmsvcrtd.a \
239        libmsvcr70.a libmsvcr70d.a \
240        libmsvcr71.a libmsvcr71d.a \
241        libmsvcr80.a libmsvcr80d.a \
242        libmsvcr90.a libmsvcr90d.a \
243        libmsvcr100.a libmsvcr100d.a \
244        libmingw32.a \
245        libcoldname.a \
246        libmoldname.a   libmoldnamed.a \
247        libmoldname70.a libmoldname70d.a \
248        libmoldname71.a libmoldname71d.a \
249        libmoldname80.a libmoldname80d.a \
250        libmoldname90.a libmoldname90d.a \
251        libmoldname100.a libmoldname100d.a \
252        $(LIBM_A) \
253        libmingwthrd_old.a \
254        libmingwthrd.a
255
256 DLLS = $(THREAD_DLL_NAME)
257
258 INSTDOCS = CONTRIBUTORS \
259            DISCLAIMER \
260            README
261
262 SRCDIST_FILES = CRT_noglob.c CRTfmode.c CRTglob.c CRTinit.c ChangeLog \
263 Makefile.in README TODO config.guess config.sub configure configure.in \
264 aclocal.m4 crt1.c crtdll.def crtmt.c crtst.c  dllcrt1.c dllmain.c \
265 gccmain.c init.c install-sh jamfile main.c mkinstalldirs \
266 moldname.def.in msvcrt.def.in ofmt_stub.s \
267 mthr.c mthr_init.c tlsmcrt.c tlsmthread.c tlssup.c tlsthrd.c readme.txt \
268 isascii.c iscsym.c iscsymf.c toascii.c \
269 strcasecmp.c strncasecmp.c wcscmpi.c \
270 CRT_fp8.c CRT_fp10.c test_headers.c txtmode.c binmode.c pseudo-reloc.c \
271 pseudo-reloc-list.c cpu_features.c cpu_features.h \
272 DISCLAIMER CONTRIBUTORS
273
274
275 all_dlls_host = @all_dlls_host@
276 install_dlls_host = @install_dlls_host@
277
278 all: $(CRT0S) $(LIBS) $(all_dlls_host)
279
280 all_dlls_host: $(DLLS)
281
282 install_dlls_host:
283         for i in $(DLLS); do \
284                 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(inst_bindir)/$$i ; \
285         done
286
287 _libm_dummy.o:
288         rm -f _libm_dummy.c
289         echo "static int __mingw_libm_dummy;" > _libm_dummy.c
290         $(CC) -c $(ALL_CFLAGS) _libm_dummy.c
291         rm -f _libm_dummy.c
292
293 libm.a: _libm_dummy.o
294         $(AR) rc $@ _libm_dummy.o
295         $(RANLIB) $@
296
297 libmingwthrd.a: crtmt.o
298         $(AR) $(ARFLAGS) $@ crtmt.o
299         $(RANLIB) $@
300
301 libmingwthrd_old.a: crtmt.o mingwthrd.def
302         $(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(THREAD_DLL_NAME) \
303           --def mingwthrd.def --output-lib $@
304         $(AR) $(ARFLAGS) $@ crtmt.o
305         $(RANLIB) $@
306
307 DLL_OFILES        = mthr.o mthr_init.o
308 DLL_CC_STUFF      = -B./ -shared $(MNO_CYGWIN) -Wl,--image-base,0x6FBC0000 \
309                     -Wl,--entry,_DllMainCRTStartup@12 \
310                     $(DLL_OFILES) mingwthrd.def \
311                     -Lmingwex
312
313 $(THREAD_DLL_NAME) mingwthrd.def: $(DLL_OFILES) Makefile $(SUBDIRS)
314         $(DLLTOOL) --as $(AS) --output-def mingwthrd.def $(DLL_OFILES)
315         $(CC) $(DLL_CC_STUFF) -o $(THREAD_DLL_NAME)
316
317 libmingw32.a: $(MINGW_OBJS)
318         $(AR) rc $@ $(MINGW_OBJS)
319         $(RANLIB) $@
320
321 msvcrt.def  msvcrtd.def \
322 msvcr70.def msvcr70d.def \
323 msvcr71.def msvcr71d.def \
324 msvcr80.def msvcr80d.def \
325 msvcr90.def msvcr90d.def \
326 msvcr100.def msvcr100d.def: msvcrt.def.in
327         V=`echo $@ | sed -e 's|[a-z]*\([0-9]*\).*|\1|'`; \
328         test -z "$$V" && V=60; \
329         V="0x0$${V}0"; \
330         $(CC) -DRUNTIME=$(basename $(notdir $@)) \
331                 -D__MSVCRT_VERSION__=$$V \
332                 -D__$(basename $(notdir $@))__=1 \
333                 -D__MSVCRT__ -C -E -P \
334                 -xc-header $? > $@
335
336 moldname-crtdll.def: moldname.def.in
337         $(CC) -DRUNTIME=crtdll \
338                 -D__FILENAME__=moldname-crtdll.def \
339                 -D__CRTDLL__  -C -E -P \
340                 -xc-header $? > $@
341
342 moldname-msvcrt.def: moldname.def.in
343         $(CC) -DRUNTIME=msvcrt \
344                 -D__FILENAME__=moldname-msvcrt.def \
345                 -D__MSVCRT__  -C -E -P \
346                 -xc-header $? > $@
347
348 libcoldname.a: moldname-crtdll.def $(MOLD_OBJS)
349         $(DLLTOOL) --as $(AS) -k -U     \
350                 --dllname crtdll.dll    \
351                 --def moldname-crtdll.def       \
352                 --output-lib $@
353         $(AR) rc $@ $(MOLD_OBJS)
354         $(RANLIB) $@
355
356 libmoldname.a libmoldnamed.a: moldname-msvcrt.def $(MOLD_OBJS)
357         $(DLLTOOL) --as $(AS) -k -U     \
358                 --dllname msvcrt$(@:libmoldname%a=%)dll \
359                 --def moldname-msvcrt.def       \
360                 --output-lib $@
361         $(AR) rc $@ $(MOLD_OBJS)
362         $(RANLIB) $@
363
364 libmoldname70.a libmoldname70d.a \
365 libmoldname71.a libmoldname71d.a \
366 libmoldname80.a libmoldname80d.a \
367 libmoldname90.a libmoldname90d.a \
368 libmoldname100.a libmoldname100d.a: moldname-msvcrt.def $(MOLD_OBJS)
369         $(DLLTOOL) --as $(AS) -k -U     \
370                 --dllname msvcr$(@:libmoldname%a=%)dll  \
371                 --def moldname-msvcrt.def       \
372                 --output-lib $@
373         $(AR) rc $@ $(MOLD_OBJS)
374         $(RANLIB) $@
375
376 # These special rules are necessary...
377 #
378 crt1.o dllcrt1.o:
379         $(CC) -c -D__CRTDLL__ -U__MSVCRT__ $(ALL_CFLAGS) $< -o $@
380
381 crt2.o dllcrt2.o:
382         $(CC) -c -D__MSVCRT__ -U__CRTDLL__ $(ALL_CFLAGS) $< -o $@
383
384 check: check-headers
385
386 TEST_H_OPTIONS = $(ALL_CFLAGS) -Wall -W -Wsystem-headers -c \
387         $(srcdir)/test_headers.c -o test_headers.o
388
389 .PHONY: check-headers
390 check-headers: force
391         @echo "Testing runtime headers..."
392         @for lang in c c++ objective-c ; do \
393                 echo "$$lang ..."; \
394                 $(CC) -x$$lang  $(TEST_H_OPTIONS) ; \
395                 echo "$$lang -ansi"; \
396                 $(CC) -x$$lang -ansi $(TEST_H_OPTIONS) ; \
397         done
398         @echo; echo "Testing runtime 8.0 headers..."
399         @for lang in c c++ objective-c ; do \
400                 echo "$$lang ..."; \
401                 $(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 $(TEST_H_OPTIONS) ; \
402                 echo "$$lang -ansi"; \
403                 $(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 -ansi $(TEST_H_OPTIONS) ; \
404         done
405         @echo; echo "Testing runtime 8.0(time32) headers..."
406         @for lang in c c++ objective-c ; do \
407                 echo "$$lang ..."; \
408                 $(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 -D_USE_32BIT_TIME_T $(TEST_H_OPTIONS) ; \
409                 echo "$$lang -ansi"; \
410                 $(CC) -x$$lang -Wall -D__MSVCRT_VERSION__=0x0800 -D_USE_32BIT_TIME_T -ansi $(TEST_H_OPTIONS) ; \
411         done
412         @echo; echo "Testing runtime 8.0(time32) headers..."
413 # specify -std=xx only for C
414         @for std in gnu89 gnu99 c89 c99 ; do \
415                 echo "std = $$std"; \
416                 $(CC) -std=$$std  $(TEST_H_OPTIONS) ; \
417         done
418
419         @rm -f test_headers.o
420
421 clean:
422         -rm -f *.o *.a *~ core a.out mingwthrd.def mingwthrd.base mingwthrd.exp
423         -rm -f $(THREAD_DLL_NAME) mingwthrd_dummy.exe
424         -rm -f msvcr*.def moldname-*.def
425         @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
426
427 distclean: clean
428         @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
429         -rm -f config.cache config.status config.log
430         -rm -f Makefile
431
432 ifdef SNAPDATE
433       distdir=$(PACKAGE)-$(VERSION)-$(SNAPDATE)
434 else
435    ifneq (,$(findstring cygwin, $(target_alias)))
436       distdir=$(PACKAGE)-$(VERSION)-$(CYGRELEASE)
437    else
438       distdir=$(PACKAGE)-$(VERSION)-$(host_os)
439    endif
440 endif
441
442 ifneq (,$(findstring cygwin, $(target_alias)))
443 #
444 # FIXME: Dubious use of `target_alias', yet again.
445 #
446 # Once more, the default settings for these macros could be
447 # more productively determined by `configure'.
448 #
449   TARFLAGS = j
450   TARFILEEXT = .tar.bz2
451   dist_prefix = $(conf_prefix)
452 endif
453
454 dist: srcdist bindist
455
456 srcdist:
457         rm -rf $(distdir)
458         mkdir $(distdir)
459         chmod 755 $(distdir)
460         for i in $(SRCDIST_FILES); do \
461                 cp -p $(srcdir)/$$i $(distdir)/$$i ; \
462         done
463         for i in $(SUBDIRS); do \
464                 (cd $$i; $(MAKE) distdir=../$(distdir) dist); \
465         done
466 #FIXME this needs to be done with SUBDIRS and Makefiles.
467 #
468 #  Maybe, but this is simpler, and adequate for now!
469 #  However, as more manpages are added, spanning multiple sections,
470 #  we'll probably need a separate Makefile to organise them.
471 #
472         mkdir $(distdir)/include
473         mkdir $(distdir)/include/sys
474         cp $(srcdir)/include/*.h $(distdir)/include/
475         cp $(srcdir)/include/sys/*.h $(distdir)/include/sys/
476         mkdir $(distdir)/man
477         cp $(srcdir)/man/*.man $(distdir)/man/
478 #
479 #end FIXME
480         rm -f $(distdir)-src.tar.gz
481         $(TAR) $(TARFLAGS)cf $(distdir)-src$(TARFILEEXT) $(distdir)
482
483 # Binary package structure is determined according to the
484 # preferred package name assigned at configure time...
485 #
486 bindist: bindist-$(PACKAGE)
487
488 # The directory structure is common to both package styles...
489 #
490 bindist-common:
491         rm -rf $(distdir)
492         mkdir $(distdir)
493         chmod 755 $(distdir)
494         $(MAKE) install prefix=$(shell pwd)/$(distdir)$(dist_prefix)
495         rm -f $(distdir).tar.gz
496
497 # Current MinGW distributions prefer separate `dev' and `dll' bundles,
498 # and use the abbreviated `mingwrt' form for the package name...
499 #
500 DEVDIST_FILES = * --exclude=bin
501 DLLDIST_FILES = bin/*.dll doc/*
502 #
503 bindist-mingwrt: bindist-common
504         cd $(distdir); \
505         $(TAR) $(TARFLAGS)cf ../$(distdir)-dev$(TARFILEEXT) $(DEVDIST_FILES); \
506         $(TAR) $(TARFLAGS)cf ../$(distdir)-dll$(TARFILEEXT) $(DLLDIST_FILES)
507         rm -rf $(distdir)
508
509 # However, Cygwin maintainers continue to prefer a composite package,
510 # retaining the older `mingw-runtime' naming convention...
511 #
512 BINDIST_FILES = *
513 #
514 bindist-mingw-runtime: bindist-common
515         cd $(distdir); \
516         $(TAR) $(TARFLAGS)cf ../$(distdir)$(TARFILEEXT) $(BINDIST_FILES)
517         rm -rf $(distdir)
518
519 snapshot:
520         make dist SNAPDATE=$(shell date '+%Y%m%d')
521
522 info:
523
524 info-html:
525
526 install-info: info
527
528 .PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
529
530 $(need-DESTDIR-compatibility):
531         @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
532           $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
533         esac
534
535 fail-DESTDIR-compatibility:
536         $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
537         try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
538
539 install-dirs: $(need-DESTDIR-compatibility)
540         $(mkinstalldirs) $(DESTDIR)$(inst_bindir)
541         $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
542         $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
543         $(mkinstalldirs) $(DESTDIR)$(inst_docdir)
544         $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
545
546 install: all install-dirs $(install_dlls_host)
547         for i in $(LIBS); do \
548                 $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
549         done
550         for i in $(CRT0S); do \
551                 $(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
552         done
553         for i in $(INSTDOCS); do \
554                 $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(inst_docdir)/$$i ; \
555         done
556         for sub in . sys ; do \
557                 dstdir=$(DESTDIR)$(inst_includedir)/$$sub ; \
558                 $(mkinstalldirs) $$dstdir ; \
559                 for i in $(srcdir)/include/$$sub/*.h ; do \
560                   $(INSTALL_DATA) $$i $$dstdir/`basename $$i` ; \
561                 done ; \
562         done
563 #
564 # This provisional hack installs the only manpage we have at present...
565 # It simply CANNOT suffice, when we have more manpages to ship.
566 #
567         $(mkinstalldirs) $(DESTDIR)$(mandir)/man$(mansection)
568         $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
569           echo dirname.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
570         $(INSTALL_DATA) $(srcdir)/man/dirname.man $(DESTDIR)$(mandir)/man$(mansection)/`\
571           echo basename.man|sed '$(manpage_transform);s,man$$,$(mansection),'`
572 #
573 # End provisional hack.
574 #
575         @$(MAKE) subdirs DO=$@ $(FLAGS_TO_PASS)
576
577 subdirs: $(SUBDIRS)
578 $(SUBDIRS): force
579         @test -n "$(DO)" && g="$(DO)" || g=all; echo "Making \`$$g' in \`$@'"
580         @cd $@; $(MAKE) $(FLAGS_TO_PASS) $(DO)
581
582 force:
583
584 #
585 # Dependencies
586 #
587 libcrtdll.a: crtdll.def
588 libmsvcrt.a: msvcrt.def
589 libmsvcrtd.a: msvcrtd.def
590 CRT_noglob.o: CRT_noglob.c
591 CRTfmode.o: CRTfmode.c
592 CRTglob.o: CRTglob.c
593 CRTinit.o: CRTinit.c
594 crt1.o: crt1.c init.c
595 crt2.o: crt1.c init.c
596 crtmt.o: crtmt.c
597 crtst.o: crtst.c
598 ctype_old.o: ctype_old.c
599 dllcrt1.o: dllcrt1.c
600 dllcrt2.o: dllcrt1.c
601 dllmain.o: dllmain.c
602 main.o: main.c
603 oldnames.o: oldnames.c
604 string_old.o: string_old.c
605 CRT_fp8.o: CRT_fp8.c
606 CRT_fp10.o: CRT_fp10.c
607
608
609 Makefile: Makefile.in config.status configure
610         $(SHELL) config.status
611
612 config.status: configure
613         $(SHELL) config.status --recheck
614
615 .SUFFIXES: .y $(SUFFIXES) .cc .def .a
616
617 sym_prefix = __msvcrt
618
619 NM_LOOKUP = $(NM) $@ | sed -n \
620   -e '/:$$/h;/^[0-7][0-7]*  *T  */{s///;H;g;s/\n//p' \
621   -e '}' | sed -n 's/:_'"$$key"'$$//p'
622
623 MINGW_REPL_FUNCS = printf fprintf sprintf vprintf vfprintf vsprintf
624
625 lib%.a: %.def
626         $(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@ --def $<
627         for key in $(MINGW_REPL_FUNCS); do \
628           src=`$(NM_LOOKUP)`; \
629           if test -n "$$src"; then \
630             dst=`echo "$$src" | sed 's/0/4/'`; repl="$$repl $$dst"; \
631             tmpfiles="$$tmpfiles $$src $$dst"; \
632             $(AR) x $@ $$src; \
633             $(OBJCOPY) --redefine-sym _$$key=_$(sym_prefix)_$$key \
634               --redefine-sym __imp__$$key=__imp__$(sym_prefix)_$$key \
635               $$src $$dst; \
636           fi; done; \
637         test `key=_get_output_format; $(NM_LOOKUP)` || \
638           repl="$$repl ofmt_stub.o"; \
639         test -n "$$repl" && $(AR) rcs $@ $$repl; \
640         $(RM) $$tmpfiles
641
642 libmsvcrt.a  libmsvcrtd.a:  ofmt_stub.o
643 libmsvcr70.a libmsvcr70d.a: ofmt_stub.o
644 libmsvcr71.a libmsvcr71d.a: ofmt_stub.o
645 libcrtdll.a  libcrtdlld.a:  ofmt_stub.o
646
647 .c.o:
648         $(CC) -c $(ALL_CFLAGS) $< -o $@
649
650 # $RCSfile$: end of file