6 # This file is part of a free library for the Win32 API.
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.
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'.
24 target_alias = @target@
25 with_cross_host = @with_cross_host@
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.
37 ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
38 EXTRA_INCLUDES = -nostdinc -iwithprefix include @EXTRA_INCLUDES@
41 DLLTOOL_FLAGS = --as=$(AS) -k
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.
52 need-DESTDIR-compatibility = prefix libdir includedir
53 .PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
55 $(need-DESTDIR-compatibility):
56 @test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
57 $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
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)
64 # Define the set of generic build rules, which are common to
65 # the build processes for all subdirectories.
68 $(CC) -c $(ALL_CFLAGS) -o $@ $<
71 $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def ${srcdir}/$*.def
76 $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
82 # Install headers and libraries in a target specified directory.
84 mkinstalldirs = @MKDIR_P@
87 exec_prefix = @exec_prefix@
89 ifeq ($(target_alias),$(host_alias))
90 ifeq ($(build_alias),$(host_alias))
91 tooldir = ${exec_prefix}
93 tooldir = ${exec_prefix}/$(target_alias)
96 tooldir = ${exec_prefix}/$(target_alias)
98 ifneq (,$(findstring cygwin,$(target_alias)))
99 inst_includedir = $(tooldir)/include/w32api
100 inst_libdir = $(tooldir)/lib/w32api
102 ifneq (,$(with_cross_host))
103 inst_includedir = $(tooldir)/include/w32api
104 inst_libdir = $(tooldir)/lib
106 inst_includedir = @includedir@
107 inst_libdir = @libdir@
112 INSTALL_PROGRAM = @INSTALL_PROGRAM@
113 INSTALL_DATA = @INSTALL_DATA@
115 # The "clean" class of rules is common to all subdirs.
124 rm -f config.cache config.status config.log Makefile
126 maintainer-clean: distclean
128 # Rules for rebuilding makefiles in sub-directories:
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.
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
142 Makefile: ${top_builddir}/Makefile.comm
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.
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
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.
158 ${top_builddir}/config.status: ${top_srcdir}/configure
159 cd ${top_builddir} && $(SHELL) config.status --recheck
161 # Makefile.comm.in: end of file