OSDN Git Service

* lib/test.c (Win32_Winsock): Replace with __USE_W32_SOCKETS.
[pf3gnuchains/pf3gnuchains4x.git] / winsup / w32api / lib / Makefile.in
1 #
2 #       Makefile.in
3 #
4 #       This file is part of a free library for the Win32 API.
5
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.
9
10
11 # start config section
12
13 SHELL = @SHELL@
14
15 srcdir = @srcdir@
16 VPATH = @srcdir@
17
18 host_alias = @host_alias@
19 build_alias = @build_alias@
20 target_alias = @target_alias@
21 prefix = @prefix@
22 includedir:=@includedir@
23 libdir:=@libdir@
24
25 program_transform_name = @program_transform_name@
26 exec_prefix = @exec_prefix@
27 bindir = @bindir@
28 ifeq ($(target_alias),$(host_alias))
29 ifeq ($(build_alias),$(host_alias))
30 tooldir:=$(exec_prefix)
31 else
32 tooldir:=$(exec_prefix)/$(target_alias)
33 endif
34 else
35 tooldir:=$(exec_prefix)/$(target_alias)
36 endif
37 datadir = @datadir@
38 infodir = @infodir@
39 ifneq (,$(findstring cygwin,$(target_alias)))
40 inst_includedir:=$(tooldir)/include/w32api
41 inst_libdir:=$(tooldir)/lib/w32api
42 else
43 inst_includedir:=$(includedir)
44 inst_libdir:=$(libdir)
45 endif
46
47 INSTALL = @INSTALL@
48 INSTALL_DATA = @INSTALL_DATA@
49 INSTALL_PROGRAM = @INSTALL_PROGRAM@
50 mkinstalldirs = mkdir -p
51
52 CC = @CC@
53 CC_FOR_TARGET = $(CC)
54
55 DLLTOOL = @DLLTOOL@
56 DLLTOOL_FLAGS = --as=$(AS) -k
57 AS = @AS@
58 AS_FOR_TARGET = $(AS_FOR_TARGET)
59 WINDRES = @WINDRES@
60
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
63 # from the C library.
64 BUILDENV = @BUILDENV@
65
66 ifeq ($(BUILDENV), cygwin)
67 # winsup/include
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
71 endif
72 ifeq ($(BUILDENV), mingw)
73 EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
74 endif
75
76 INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
77
78 CFLAGS = @CFLAGS@
79 ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
80
81 RANLIB = @RANLIB@
82 AR = @AR@
83 LD = @LD@
84
85 # end config section
86
87 # headers
88
89 HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
90
91 # libraries
92
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
101
102 DISTFILES = Makefile.in $(DEF_FILES) $(SOURCES)
103
104 # targets
105 all: $(LIBS) $(EXTRA_OBJS)
106
107 TEST_OPTIONS = $(ALL_CFLAGS) -Wall -c $(srcdir)/test.c -o test.o
108 .PHONY: test
109 test:
110         @echo "Testing w32api..."
111         @for lang in c c++ objective-c ; do \
112                 echo "$$lang..."; \
113                 $(CC) -x$$lang $(TEST_OPTIONS) ; \
114                 echo "$$lang UNICODE..."; \
115                 $(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
116         done
117         @echo "windres..."
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
121         @rm -f test.o
122
123 scrnsavw.o: scrnsave.c
124         $(CC) -c $(ALL_CFLAGS) -DUNICODE -o $@ $<
125
126 # make rules
127
128 .SUFFIXES: .c .o .def .a
129
130 .c.o:
131         $(CC) -c $(ALL_CFLAGS) -o $@ $<
132
133 lib%.a : %.def %.o
134         $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
135         $(AR) r $@ $*.o
136         $(RANLIB) $@
137
138 lib%.a: %.def
139         $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
140
141 lib%.a: %.o
142         $(AR) rc $@ $*.o
143         $(RANLIB) $@
144
145 # install headers and libraries in a target specified directory.
146 install: install-libraries install-headers
147
148 install-libraries: all
149         $(mkinstalldirs) $(inst_libdir)
150         for i in $(LIBS); do \
151                 $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
152         done
153
154 install-headers:
155         $(mkinstalldirs) $(inst_includedir)
156         for i in $(HEADERS); do \
157                 $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
158         done
159
160 # uninstall headers and libraries from a target specified directory
161 uninstall: uninstall-libraries uninstall-headers
162
163 uninstall-libraries:
164         @for i in $(LIBS); do \
165                 rm -f $(inst_libdir)/$$i ; \
166         done
167         rmdir $(inst_libdir)
168
169 uninstall-headers:
170         @for i in $(HEADERS); do \
171                 rm -r $(inst_includedir)/$$i ; \
172         done
173         rmdir $(inst_includedir)
174
175
176 dist:
177         mkdir $(distdir)/include
178         chmod 755 $(distdir)/include
179         @for i in $(HEADERS); do \
180                 cp -p $(srcdir)/../include/$$i $(distdir)/include/$$i ; \
181         done
182         mkdir $(distdir)/lib
183         chmod 755 $(distdir)/lib
184         @for i in $(DISTFILES); do \
185                 cp -p $(srcdir)/$$i $(distdir)/lib/$$i ; \
186         done
187
188 Makefile: Makefile.in ../config.status ../configure
189         cd ..; $(SHELL) config.status
190
191 # clean
192
193 mostlyclean:
194         rm -f *~ *.o *.s
195
196 clean:
197         rm -f *.o *.a *.s *~
198
199 distclean: clean
200         rm -f config.cache config.status config.log Makefile
201
202 maintainer-clean: distclean