OSDN Git Service

Add smart identification of auxiliary header file paths.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / w32api / Makefile.comm.in
1 # @configure_input@
2 #
3 #
4 # Makefile.comm.in
5 #
6 # This file is part of a free library for the Win32 API.
7
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 #
12 #
13 # Establish the default build rule early, to ensure it is not
14 # hijacked by any other common rule defined herein; note that
15 # this requires us to specify the real default rule using the
16 # alternative name, 'all-default'.
17 #
18 all: all-default
19
20 SHELL = @SHELL@
21
22 host_alias = @host@
23 build_alias = @build@
24 target_alias = @target@
25 with_cross_host = @with_cross_host@
26
27 # Identify the tools required to build the package.
28 # Note that we don't specify associated option flags here,
29 # since different settings may be required in individual
30 # makefiles which include this common fragment.
31 #
32 CC = @CC@
33 AS = @AS@
34 LD = @LD@
35
36 CFLAGS = @CFLAGS@
37 ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
38 EXTRA_INCLUDES = -nostdinc -iwithprefix include @EXTRA_INCLUDES@
39
40 DLLTOOL = @DLLTOOL@
41 DLLTOOL_FLAGS = --as=$(AS) -k
42 WINDRES = @WINDRES@
43
44 RANLIB = @RANLIB@
45 AR = @AR@
46
47 # In spite of its general unsuitability for use on MS-Windows hosts,
48 # Cygwin is able to, and likes to support the $(DESTDIR) capability;
49 # provide a graceful rejection mechanism, for any (non-Cygwin) cases
50 # where it cannot be used.
51 #
52 need-DESTDIR-compatibility = prefix libdir includedir
53 .PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
54
55 $(need-DESTDIR-compatibility):
56         @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
57           $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
58         esac
59
60 fail-DESTDIR-compatibility:
61         $(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
62         try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
63
64 # Define the set of generic build rules, which are common to
65 # the build processes for all subdirectories.
66 #
67 %.o: %.c
68         $(CC) -c $(ALL_CFLAGS) -o $@ $<
69
70 lib%.a : %.def %.o
71         $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def ${srcdir}/$*.def
72         $(AR) r $@ $*.o
73         $(RANLIB) $@
74
75 lib%.a: %.def
76         $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
77
78 lib%.a: %.o
79         $(AR) rc $@ $*.o
80         $(RANLIB) $@
81
82 # Install headers and libraries in a target specified directory.
83 #
84 mkinstalldirs = @MKDIR_P@
85
86 prefix = @prefix@
87 exec_prefix = @exec_prefix@
88
89 ifeq ($(target_alias),$(host_alias))
90   ifeq ($(build_alias),$(host_alias))
91     tooldir = ${exec_prefix}
92   else
93     tooldir = ${exec_prefix}/$(target_alias)
94   endif
95 else
96   tooldir = ${exec_prefix}/$(target_alias)
97 endif
98 ifneq (,$(findstring cygwin,$(target_alias)))
99   inst_includedir = $(tooldir)/include/w32api
100   inst_libdir = $(tooldir)/lib/w32api
101 else
102   ifneq (,$(with_cross_host))
103     inst_includedir = $(tooldir)/include/w32api
104     inst_libdir = $(tooldir)/lib
105   else
106     inst_includedir = @includedir@
107     inst_libdir = @libdir@
108   endif
109 endif
110
111 INSTALL = @INSTALL@
112 INSTALL_PROGRAM = @INSTALL_PROGRAM@
113 INSTALL_DATA = @INSTALL_DATA@
114
115 # The "clean" class of rules is common to all subdirs.
116 #
117 mostlyclean:
118         rm -f *~ *.o *.s
119
120 clean:
121         rm -f *.o *.a *.s *~
122
123 distclean: clean
124         rm -f config.cache config.status config.log Makefile
125
126 maintainer-clean: distclean
127
128 # Rules for rebuilding makefiles in sub-directories:
129 #
130 # Each of these should be rebuilt when its own Makefile.in is modified,
131 # or when ${top_builddir}/config.status is updated.  Rebuilding is achieved
132 # by running ${top_builddir}/config.status, with ${top_builddir} as CWD; as
133 # a side effect this also rebuilds all other makefiles in the package tree.
134 # In particular, it causes ${top_builddir}/Makefile.comm.in to be rebuilt,
135 # BEFORE any sub-directory specific Makefile is updated.
136 #
137 # Since ${top_builddir}/Makefile.comm is also required by each individual
138 # sub-directory Makefile, and since all sub-directory makefiles are ALWAYS
139 # updated along with ${top_builddir}/Makefile.comm, we may simply declare
140 # the dependency...
141 #
142 Makefile: ${top_builddir}/Makefile.comm
143
144 # ...then by adding Makefile.in as an artificial prerequisite of this,
145 # together with its own real dependence on ${top_builddir}/config.status
146 # and ${top_srcdir}/Makefile.comm.in, we can simply rely on the mutually
147 # effective rebuilding side effects to update both the subdirectory's own
148 # Makefile, and ${top_builddir}/Makefile.comm, in a single operation.
149 #
150 ${top_builddir}/Makefile.comm: ${top_builddir}/config.status
151 ${top_builddir}/Makefile.comm: Makefile.in ${top_srcdir}/Makefile.comm.in
152         cd ${top_builddir} && $(SHELL) config.status
153
154 # ${top_builddir}/config.status must itself be updated, at any time when
155 # ${top_srcdir}/configure has been modified; this is a distinct operation
156 # from the rebuilding of makefiles.
157 #
158 ${top_builddir}/config.status: ${top_srcdir}/configure
159         cd ${top_builddir} && $(SHELL) config.status --recheck
160
161 # Makefile.comm.in: end of file