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 host_alias = @host_alias@
19 build_alias = @build_alias@
20 target_alias = @target_alias@
22 includedir:=@includedir@
25 program_transform_name = @program_transform_name@
26 exec_prefix = @exec_prefix@
28 ifeq ($(target_alias),$(host_alias))
29 ifeq ($(build_alias),$(host_alias))
30 tooldir:=$(exec_prefix)
32 tooldir:=$(exec_prefix)/$(target_alias)
35 tooldir:=$(exec_prefix)/$(target_alias)
39 ifneq (,$(findstring cygwin,$(target_alias)))
40 inst_includedir:=$(tooldir)/include/w32api
41 inst_libdir:=$(tooldir)/lib/w32api
43 inst_includedir:=$(includedir)
44 inst_libdir:=$(libdir)
48 INSTALL_DATA = @INSTALL_DATA@
49 INSTALL_PROGRAM = @INSTALL_PROGRAM@
50 mkinstalldirs = mkdir -p
56 DLLTOOL_FLAGS = --as=$(AS) -k
58 AS_FOR_TARGET = $(AS_FOR_TARGET)
61 # Depending on if we build as part of winsup or mingw we need to
62 # add additional include paths in order to get the correct headers
66 ifeq ($(BUILDENV), cygwin)
68 # winsup/../newlib/libc/include
69 # winsup/../newlib/libc/sys/cygwin
70 EXTRA_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../../../newlib/libc/include -I$(srcdir)/../../../newlib/libc/sys/cygwin
72 ifeq ($(BUILDENV), mingw)
73 EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
76 INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
79 ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
89 HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
93 DEF_FILES = $(notdir $(wildcard $(srcdir)/*.def))
94 IMPLIBS = $(addprefix lib,$(subst .def,.a,$(DEF_FILES)))
95 EXTRA_LIBS=libuuid.a libscrnsave.a libscrnsavw.a libdxguid.a liblargeint.a
96 LIBS = $(IMPLIBS) $(EXTRA_LIBS)
97 EXTRA_OBJS=uuid.o shell32.o dxguid.o scrnsave.o scrnsavw.o largeint.o \
98 $(UUID_OBJS) dinput.o kernel32.o
99 SOURCES = scrnsave.c shell32.c uuid.c largeint.c dinput.c dxguid.c \
100 res.rc test.c kernel32.c
102 DISTFILES = Makefile.in $(DEF_FILES) $(SOURCES)
105 all: $(LIBS) $(EXTRA_OBJS)
107 TEST_OPTIONS = $(ALL_CFLAGS) -Wall -c $(srcdir)/test.c -o test.o
110 @echo "Testing w32api..."
111 @for lang in c c++ objective-c ; do \
113 $(CC) -x$$lang $(TEST_OPTIONS) ; \
114 echo "$$lang UNICODE..."; \
115 $(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
118 @$(WINDRES) --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
119 @echo "windres UNICODE..."
120 @$(WINDRES) --define UNICODE --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
123 scrnsavw.o: scrnsave.c
124 $(CC) -c $(ALL_CFLAGS) -DUNICODE -o $@ $<
128 .SUFFIXES: .c .o .def .a
131 $(CC) -c $(ALL_CFLAGS) -o $@ $<
134 $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
139 $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
145 # install headers and libraries in a target specified directory.
146 install: install-libraries install-headers
148 install-libraries: all
149 $(mkinstalldirs) $(inst_libdir)
150 for i in $(LIBS); do \
151 $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
155 $(mkinstalldirs) $(inst_includedir)
156 for i in $(HEADERS); do \
157 $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
160 # uninstall headers and libraries from a target specified directory
161 uninstall: uninstall-libraries uninstall-headers
164 @for i in $(LIBS); do \
165 rm -f $(inst_libdir)/$$i ; \
170 @for i in $(HEADERS); do \
171 rm -r $(inst_includedir)/$$i ; \
173 rmdir $(inst_includedir)
177 mkdir $(distdir)/include
178 chmod 755 $(distdir)/include
179 @for i in $(HEADERS); do \
180 cp -p $(srcdir)/../include/$$i $(distdir)/include/$$i ; \
183 chmod 755 $(distdir)/lib
184 @for i in $(DISTFILES); do \
185 cp -p $(srcdir)/$$i $(distdir)/lib/$$i ; \
188 Makefile: Makefile.in ../config.status ../configure
189 cd ..; $(SHELL) config.status
200 rm -f config.cache config.status config.log Makefile
202 maintainer-clean: distclean