4 # This file is part of a free library for the Win32 API.
6 # This library is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # start config section
18 SUBDIRS := ddk directx
19 subdirs := ddk directx
23 target_alias = @target@
24 with_cross_host = @with_cross_host@
26 includedir:=@includedir@
28 program_transform_name = @program_transform_name@
29 exec_prefix = @exec_prefix@
32 ifeq ($(target_alias),$(host_alias))
33 ifeq ($(build_alias),$(host_alias))
34 tooldir:=$(exec_prefix)
36 tooldir:=$(exec_prefix)/$(target_alias)
39 tooldir:=$(exec_prefix)/$(target_alias)
43 ifneq (,$(findstring cygwin,$(target_alias)))
44 inst_includedir:=$(tooldir)/include/w32api
45 inst_libdir:=$(tooldir)/lib/w32api
47 ifneq (,$(with_cross_host))
48 inst_includedir:=$(tooldir)/include/w32api
49 inst_libdir:=$(tooldir)/lib
51 inst_includedir:=$(includedir)
52 inst_libdir:=$(libdir)
57 INSTALL_DATA = @INSTALL_DATA@
58 INSTALL_PROGRAM = @INSTALL_PROGRAM@
59 mkinstalldirs = mkdir -p
65 DLLTOOL_FLAGS = --as=$(AS) -k
67 AS_FOR_TARGET = $(AS_FOR_TARGET)
70 # Depending on if we build as part of winsup or mingw we need to
71 # add additional include paths in order to get the correct headers
75 ifeq ($(BUILDENV), cygwin)
77 # winsup/../newlib/libc/include
78 # winsup/../newlib/libc/sys/cygwin
79 EXTRA_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../../../newlib/libc/include -I$(srcdir)/../../../newlib/libc/sys/cygwin
81 ifeq ($(BUILDENV), mingw)
82 EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
85 INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
88 ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
97 CPPFLAGS="$(CPPFLAGS)" \
99 CXXFLAGS="$(CXXFLAGS)" \
103 DLLTOOL="$(DLLTOOL)" \
105 TARFLAGS="$(TARFLAGS)" \
106 TARFILEEXT="$(TARFILEEXT)" \
113 HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
114 GL_HEADERS = $(notdir $(wildcard $(srcdir)/../include/GL/*.h))
118 DEF_FILES = $(notdir $(wildcard $(srcdir)/*.def))
119 MRI_FILES = $(notdir $(wildcard $(srcdir)/*.mri))
120 IMPLIBS = $(addprefix lib,$(subst .def,.a,$(DEF_FILES)))
121 MIMPLIBS = $(addprefix lib,$(subst .mri,.a,$(MRI_FILES)))
122 EXTRA_LIBS=libuuid.a libscrnsave.a libscrnsavw.a liblargeint.a
123 LIBS = $(IMPLIBS) $(MIMPLIBS) $(EXTRA_LIBS)
124 UUID_OBJS = mshtml-uuid.o msxml-uuid.o unknwn-uuid.o \
125 servprov-uuid.o oleidl-uuid.o oleacc-uuid.o ocidl-uuid.o \
126 objsafe-uuid.o oaidl-uuid.o docobj-uuid.o comcat-uuid.o \
127 exdisp-uuid.o mlang-uuid.o objidl-uuid.o cguid-uuid.o \
128 olectlid-uuid.o ativscp-uuid.o urlmon-uuid.o hlink-uuid.o \
129 hlguids-uuid.o extras-uuid.o devguid.o
130 EXTRA_OBJS = shell32.o scrnsave.o scrnsavw.o largeint.o \
131 $(UUID_OBJS) ws2_32.o
132 UUID_SOURCES = mshtml-uuid.c msxml-uuid.c unknwn-uuid.c \
133 servprov-uuid.c oleidl-uuid.c oleacc-uuid.c ocidl-uuid.c \
134 objsafe-uuid.c oaidl-uuid.c docobj-uuid.c comcat-uuid.c \
135 exdisp-uuid.c mlang-uuid.c objidl-uuid.c cguid-uuid.c \
136 olectlid-uuid.c ativscp-uuid.c urlmon-uuid.c hlink-uuid.c \
137 hlguids-uuid.c extras-uuid.c devguid.c
138 SOURCES = scrnsave.c shell32.c largeint.c $(UUID_SOURCES)\
139 res.rc test.c ws2_32.c
141 DISTFILES = Makefile.in $(DEF_FILES) $(MRI_FILES) $(SOURCES)
146 all: $(EXTRA_OBJS) $(LIBS) ddk directx
149 for i in $(SUBDIRS); do \
150 $(MAKE) $(FLAGS_TO_PASS) -C $$i $*; \
154 $(MAKE) $(FLAGS_TO_PASS) -C $@
157 $(MAKE) $(FLAGS_TO_PASS) -C $@
159 TEST_OPTIONS = $(ALL_CFLAGS) -DWINVER=0x0666 \
160 -Wall -pedantic -Wsystem-headers -c $(srcdir)/test.c -o test.o
161 .PHONY: test ddk directx
163 @echo "Testing w32api..."
164 @for lang in c c++ objective-c ; do \
166 $(CC) -x$$lang $(TEST_OPTIONS) ; \
167 echo "$$lang UNICODE..."; \
168 $(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
171 @$(WINDRES) --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
172 @echo "windres UNICODE..."
173 @$(WINDRES) --define UNICODE --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
176 scrnsavw.o: scrnsave.c
177 $(CC) -c $(ALL_CFLAGS) -DUNICODE -o $@ $<
181 .SUFFIXES: .c .o .def .a
184 $(CC) -c $(ALL_CFLAGS) -o $@ $<
186 libuuid.a : $(UUID_OBJS)
187 $(AR) rc $@ $(UUID_OBJS)
190 # libvfw32.a contains import stubs for 3 dll's. Using an MRI script
191 # seems to be the simplest way to combine them into one archive.
192 # NB: With older dlltool, the object file members will not have unique
194 libvfw32.a : vfw32.mri libmsvfw32.a libavifil32.a libavicap32.a
196 $(AR) -M < ${word 1,$^}
200 $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
205 $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
211 .PHONY: install install-libraries install-headers install-ddk
212 # install headers and libraries in a target specified directory.
213 install: install-libraries install-headers install-ddk install-directx
215 install-libraries: all
216 $(mkinstalldirs) $(inst_libdir)
217 for i in $(LIBS); do \
218 $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
222 $(mkinstalldirs) $(inst_includedir)
223 for i in $(HEADERS); do \
224 $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
226 $(mkinstalldirs) $(inst_includedir)/GL
227 for i in $(GL_HEADERS); do \
228 $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(inst_includedir)/GL/$$i ; \
231 install-ddk: install-libraries install-headers
232 cd ddk && $(MAKE) install $(FLAGS_TO_PASS)
234 install-directx: install-libraries install-headers
235 cd directx && $(MAKE) install $(FLAGS_TO_PASS)
237 # uninstall headers and libraries from a target specified directory
238 uninstall: uninstall-ddk uninstall-directx uninstall-libraries uninstall-headers
241 @for i in $(LIBS); do \
242 rm -f $(inst_libdir)/$$i ; \
247 @for i in $(HEADERS); do \
248 rm -r $(inst_includedir)/$$i ; \
250 rmdir $(inst_includedir)
253 cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
256 cd directx && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
259 mkdir $(distdir)/include
260 chmod 755 $(distdir)/include
261 @for i in $(HEADERS); do \
262 cp -p $(srcdir)/../include/$$i $(distdir)/include/$$i ; \
264 mkdir $(distdir)/include/GL
265 @for i in $(GL_HEADERS); do \
266 cp -p $(srcdir)/../include/GL/$$i $(distdir)/include/GL/$$i ; \
269 chmod 755 $(distdir)/lib
270 @for i in $(DISTFILES); do \
271 cp -p $(srcdir)/$$i $(distdir)/lib/$$i ; \
273 for i in $(SUBDIRS); do \
274 (cd $$i; $(MAKE) distdir=../$(distdir) dist); \
277 Makefile: Makefile.in ../config.status ../configure
278 cd ..; $(SHELL) config.status
289 rm -f config.cache config.status config.log Makefile
291 maintainer-clean: distclean