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 top_srcdir = @top_srcdir@
14 top_builddir = @top_builddir@
18 include ${top_builddir}/Makefile.comm
20 SUBDIRS := ddk directx
21 subdirs := ddk directx
23 # Depending on if we build as part of winsup or mingw we need to
24 # add additional include paths in order to get the correct headers
29 ifeq ($(BUILDENV), cygwin)
31 # winsup/../newlib/libc/include
32 # winsup/../newlib/libc/sys/cygwin
33 EXTRA_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../../../newlib/libc/include -I$(srcdir)/../../../newlib/libc/sys/cygwin
35 ifeq ($(BUILDENV), mingw)
36 EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
39 INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
43 HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
44 GL_HEADERS = $(notdir $(wildcard $(srcdir)/../include/GL/*.h))
45 GDIPLUS_HEADERS = $(notdir $(wildcard $(srcdir)/../include/gdiplus/*.h))
49 DEF_FILES = $(notdir $(wildcard $(srcdir)/*.def))
50 MRI_FILES = $(notdir $(wildcard $(srcdir)/*.mri))
51 IMPLIBS = $(addprefix lib,$(subst .def,.a,$(DEF_FILES)))
52 MIMPLIBS = $(addprefix lib,$(subst .mri,.a,$(MRI_FILES)))
54 EXTRA_LIBS = libuuid.a libscrnsave.a libscrnsavw.a liblargeint.a
56 LIBS = $(IMPLIBS) $(MIMPLIBS) $(EXTRA_LIBS)
57 UUID_OBJS = mshtml-uuid.o msxml-uuid.o unknwn-uuid.o \
58 servprov-uuid.o oleidl-uuid.o oleacc-uuid.o ocidl-uuid.o \
59 objsafe-uuid.o oaidl-uuid.o docobj-uuid.o comcat-uuid.o \
60 exdisp-uuid.o mlang-uuid.o objidl-uuid.o cguid-uuid.o \
61 olectlid-uuid.o ativscp-uuid.o urlmon-uuid.o hlink-uuid.o \
62 hlguids-uuid.o extras-uuid.o devguid.o power-uuid.o
63 EXTRA_OBJS = shell32.o scrnsave.o scrnsavw.o largeint.o gdiplus.o \
65 UUID_SOURCES = mshtml-uuid.c msxml-uuid.c unknwn-uuid.c \
66 servprov-uuid.c oleidl-uuid.c oleacc-uuid.c ocidl-uuid.c \
67 objsafe-uuid.c oaidl-uuid.c docobj-uuid.c comcat-uuid.c \
68 exdisp-uuid.c mlang-uuid.c objidl-uuid.c cguid-uuid.c \
69 olectlid-uuid.c ativscp-uuid.c urlmon-uuid.c hlink-uuid.c \
70 hlguids-uuid.c extras-uuid.c devguid.c power-uuid.c
71 SOURCES = scrnsave.c shell32.c largeint.c gdiplus.c $(UUID_SOURCES) \
72 res.rc test.c ws2_32.c
74 DISTFILES = Makefile.in $(DEF_FILES) $(MRI_FILES) $(SOURCES)
78 # Targets: (note that 'all-default' is a redirection from 'all',
79 # which is the primary default target identified in the included
80 # common makefile fragment, ${top_builddir}/Makefile.comm
82 all-default: $(EXTRA_OBJS) $(LIBS) ddk directx
85 for dir in $(SUBDIRS); do \
86 $(MAKE) -C $$dir $*; \
95 TEST_OPTIONS = $(ALL_CFLAGS) -DWINVER=0x0666 \
96 -Wall -pedantic -Wsystem-headers -c $(srcdir)/test.c -o test.o
97 .PHONY: test ddk directx
99 @echo "Testing w32api..."
100 @for lang in c c++ objective-c ; do \
102 $(CC) -x$$lang $(TEST_OPTIONS); \
103 echo "$$lang UNICODE..."; \
104 $(CC) -x$$lang -DUNICODE $(TEST_OPTIONS); \
107 $(WINDRES) --include-dir $(INCDIR) -i ${srcdir}/res.rc -o test.o
108 @echo "windres UNICODE..."
109 $(WINDRES) --define UNICODE --include-dir $(INCDIR) -i ${srcdir}/res.rc -o test.o
112 scrnsavw.o: scrnsave.c
113 $(CC) -c $(ALL_CFLAGS) -DUNICODE -o $@ $<
117 libuuid.a: $(UUID_OBJS)
118 $(AR) rc $@ $(UUID_OBJS)
121 # libvfw32.a contains import stubs for 3 dll's. Using an MRI script
122 # seems to be the simplest way to combine them into one archive.
124 # NB: With older dlltool, the object file members will not have
127 libvfw32.a: vfw32.mri libmsvfw32.a libavifil32.a libavicap32.a
129 $(AR) -M < ${word 1,$^}
132 .PHONY: install install-libraries install-headers install-ddk
133 # Install headers and libraries in a target specified directory.
135 install: install-libraries install-headers install-ddk install-directx
137 install-libraries: all $(need-DESTDIR-compatibility)
138 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
139 for file in $(LIBS); do \
140 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/$$file ; \
143 install-headers: $(need-DESTDIR-compatibility)
144 $(mkinstalldirs) $(DESTDIR)$(inst_includedir)
145 for file in $(HEADERS); do \
146 $(INSTALL_DATA) $(srcdir)/../include/$$file $(DESTDIR)$(inst_includedir)/$$file ; \
148 $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/GL
149 for file in $(GL_HEADERS); do \
150 $(INSTALL_DATA) $(srcdir)/../include/GL/$$file $(DESTDIR)$(inst_includedir)/GL/$$file ; \
152 $(mkinstalldirs) $(DESTDIR)$(inst_includedir)/gdiplus
153 for file in $(GDIPLUS_HEADERS); do \
154 $(INSTALL_DATA) $(srcdir)/../include/gdiplus/$$file $(DESTDIR)$(inst_includedir)/gdiplus/$$file ; \
157 install-ddk: install-libraries install-headers
158 cd ddk && $(MAKE) install
160 install-directx: install-libraries install-headers
161 cd directx && $(MAKE) install
163 # Uninstall headers and libraries from a target specified directory
165 uninstall: uninstall-ddk uninstall-directx uninstall-libraries uninstall-headers
167 uninstall-libraries: $(need-DESTDIR-compatibility)
168 for file in $(LIBS); do \
169 rm -f $(DESTDIR)$(inst_libdir)/$$file ; \
171 rmdir $(DESTDIR)$(inst_libdir)
173 uninstall-headers: $(need-DESTDIR-compatibility)
174 for file in $(HEADERS); do \
175 rm -r $(DESTDIR)$(inst_includedir)/$$file ; \
177 rmdir $(DESTDIR)$(inst_includedir)
180 cd ddk && $(MAKE) uninstall
183 cd directx && $(MAKE) uninstall
186 mkdir $(distdir)/include
187 chmod 755 $(distdir)/include
188 for file in $(HEADERS); do \
189 cp -p $(srcdir)/../include/$$file $(distdir)/include/$$file ; \
191 mkdir $(distdir)/include/GL
192 for file in $(GL_HEADERS); do \
193 cp -p $(srcdir)/../include/GL/$$file $(distdir)/include/GL/$$file ; \
195 mkdir $(distdir)/include/gdiplus
196 for file in $(GDIPLUS_HEADERS); do \
197 cp -p $(srcdir)/../include/gdiplus/$$file $(distdir)/include/gdiplus/$$file ; \
200 chmod 755 $(distdir)/lib
201 for file in $(DISTFILES); do \
202 cp -p $(srcdir)/$$file $(distdir)/lib/$$file ; \
204 for dir in $(SUBDIRS); do \
205 (cd $$dir; $(MAKE) distdir=../$(distdir) dist); \
208 Makefile: Makefile.in ../config.status ../configure
209 cd ..; $(SHELL) config.status
211 # Makefile.in: end of file