OSDN Git Service

2006-09-11 Chris Sutcliffe <ir0n3h4d@users.sourceforge.net>
[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 SUBDIRS := ddk directx
19 subdirs := ddk directx
20
21 host_alias = @host@
22 build_alias = @build@
23 target_alias = @target@
24 with_cross_host = @with_cross_host@
25 prefix = @prefix@
26 includedir:=@includedir@
27
28 program_transform_name = @program_transform_name@
29 exec_prefix = @exec_prefix@
30 libdir:=@libdir@
31 bindir = @bindir@
32 ifeq ($(target_alias),$(host_alias))
33 ifeq ($(build_alias),$(host_alias))
34 tooldir:=$(exec_prefix)
35 else
36 tooldir:=$(exec_prefix)/$(target_alias)
37 endif
38 else
39 tooldir:=$(exec_prefix)/$(target_alias)
40 endif
41 datadir = @datadir@
42 infodir = @infodir@
43 ifneq (,$(findstring cygwin,$(target_alias)))
44 inst_includedir:=$(tooldir)/include/w32api
45 inst_libdir:=$(tooldir)/lib/w32api
46 else
47 ifneq (,$(with_cross_host))
48 inst_includedir:=$(tooldir)/include/w32api
49 inst_libdir:=$(tooldir)/lib
50 else
51 inst_includedir:=$(includedir)
52 inst_libdir:=$(libdir)
53 endif
54 endif
55
56 INSTALL = @INSTALL@
57 INSTALL_DATA = @INSTALL_DATA@
58 INSTALL_PROGRAM = @INSTALL_PROGRAM@
59 mkinstalldirs = mkdir -p
60
61 CC = @CC@
62 CC_FOR_TARGET = $(CC)
63
64 DLLTOOL = @DLLTOOL@
65 DLLTOOL_FLAGS = --as=$(AS) -k
66 AS = @AS@
67 AS_FOR_TARGET = $(AS_FOR_TARGET)
68 WINDRES = @WINDRES@
69
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
72 # from the C library.
73 BUILDENV = @BUILDENV@
74
75 ifeq ($(BUILDENV), cygwin)
76 # winsup/include
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
80 endif
81 ifeq ($(BUILDENV), mingw)
82 EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
83 endif
84
85 INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
86
87 CFLAGS = @CFLAGS@
88 ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
89
90 RANLIB = @RANLIB@
91 AR = @AR@
92 LD = @LD@
93
94 FLAGS_TO_PASS = \
95         AS="$(AS)" \
96         CC="$(CC)" \
97         CPPFLAGS="$(CPPFLAGS)" \
98         CFLAGS="$(CFLAGS)" \
99         CXXFLAGS="$(CXXFLAGS)" \
100         AR="$(AR)" \
101         RANLIB="$(RANLIB)" \
102         LD="$(LD)" \
103         DLLTOOL="$(DLLTOOL)" \
104         TAR="$(TAR)" \
105         TARFLAGS="$(TARFLAGS)" \
106         TARFILEEXT="$(TARFILEEXT)" \
107         WINDRES="$(WINDRES)"
108
109 # end config section
110
111 # headers
112
113 HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
114 GL_HEADERS = $(notdir $(wildcard $(srcdir)/../include/GL/*.h))
115
116 # libraries
117
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) kernel32.o 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 kernel32.c ws2_32.c
140
141 DISTFILES = Makefile.in $(DEF_FILES) $(MRI_FILES) $(SOURCES)
142
143 .NOTPARALLEL:
144
145 # targets
146 all: $(LIBS) $(EXTRA_OBJS) ddk directx
147
148 %-subdirs:
149         for i in $(SUBDIRS); do \
150           $(MAKE) $(FLAGS_TO_PASS) -C $$i $*; \
151         done
152
153 ddk:
154         $(MAKE) $(FLAGS_TO_PASS) -C $@
155
156 directx:
157         $(MAKE) $(FLAGS_TO_PASS) -C $@
158
159 TEST_OPTIONS = $(ALL_CFLAGS) -DWINVER=0x0666  \
160         -Wall -pedantic -Wsystem-headers -c $(srcdir)/test.c -o test.o
161 .PHONY: test ddk directx
162 test:
163         @echo "Testing w32api..."
164         @for lang in c c++ objective-c ; do \
165                 echo "$$lang..."; \
166                 $(CC) -x$$lang $(TEST_OPTIONS) ; \
167                 echo "$$lang UNICODE..."; \
168                 $(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
169         done
170         @echo "windres..."
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
174         @rm -f test.o
175
176 scrnsavw.o: scrnsave.c
177         $(CC) -c $(ALL_CFLAGS) -DUNICODE -o $@ $<
178
179 # make rules
180
181 .SUFFIXES: .c .o .def .a
182
183 .c.o:
184         $(CC) -c $(ALL_CFLAGS) -o $@ $<
185
186 libuuid.a : $(UUID_OBJS)
187         $(AR) rc $@ $(UUID_OBJS)
188         $(RANLIB) $@
189
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
193 # names.
194 libvfw32.a : vfw32.mri libmsvfw32.a libavifil32.a libavicap32.a
195         rm -f $@
196         $(AR) -M < ${word 1,$^}
197         $(RANLIB) $@
198
199 lib%.a : %.def %.o
200         $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
201         $(AR) r $@ $*.o
202         $(RANLIB) $@
203
204 lib%.a: %.def
205         $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
206
207 lib%.a: %.o
208         $(AR) rc $@ $*.o
209         $(RANLIB) $@
210
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
214
215 install-libraries: all
216         $(mkinstalldirs) $(inst_libdir)
217         for i in $(LIBS); do \
218                 $(INSTALL_DATA) $$i $(inst_libdir)/$$i ; \
219         done
220
221 install-headers:
222         $(mkinstalldirs) $(inst_includedir)
223         for i in $(HEADERS); do \
224                 $(INSTALL_DATA) $(srcdir)/../include/$$i $(inst_includedir)/$$i ; \
225         done
226         $(mkinstalldirs) $(inst_includedir)/GL
227         for i in $(GL_HEADERS); do \
228                 $(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(inst_includedir)/GL/$$i ; \
229         done
230
231 install-ddk: install-libraries install-headers
232         cd ddk && $(MAKE) install $(FLAGS_TO_PASS)
233
234 install-directx: install-libraries install-headers
235         cd directx && $(MAKE) install $(FLAGS_TO_PASS)
236
237 # uninstall headers and libraries from a target specified directory
238 uninstall: uninstall-ddk uninstall-directx uninstall-libraries uninstall-headers
239
240 uninstall-libraries:
241         @for i in $(LIBS); do \
242                 rm -f $(inst_libdir)/$$i ; \
243         done
244         rmdir $(inst_libdir)
245
246 uninstall-headers:
247         @for i in $(HEADERS); do \
248                 rm -r $(inst_includedir)/$$i ; \
249         done
250         rmdir $(inst_includedir)
251
252 uninstall-ddk:
253         cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
254
255 uninstall-directx:
256         cd directx && $(MAKE) -C uninstall $(FLAGS_TO_PASS)
257
258 dist:
259         mkdir $(distdir)/include
260         chmod 755 $(distdir)/include
261         @for i in $(HEADERS); do \
262                 cp -p $(srcdir)/../include/$$i $(distdir)/include/$$i ; \
263         done
264         mkdir $(distdir)/include/GL
265         @for i in $(GL_HEADERS); do \
266                 cp -p $(srcdir)/../include/GL/$$i $(distdir)/include/GL/$$i ; \
267         done
268         mkdir $(distdir)/lib
269         chmod 755 $(distdir)/lib
270         @for i in $(DISTFILES); do \
271                 cp -p $(srcdir)/$$i $(distdir)/lib/$$i ; \
272         done
273         for i in $(SUBDIRS); do \
274                 (cd $$i; $(MAKE) distdir=../$(distdir) dist); \
275         done
276
277 Makefile: Makefile.in ../config.status ../configure
278         cd ..; $(SHELL) config.status
279
280 # clean
281
282 mostlyclean:
283         rm -f *~ *.o *.s
284
285 clean:
286         rm -f *.o *.a *.s *~
287
288 distclean: clean
289         rm -f config.cache config.status config.log Makefile
290
291 maintainer-clean: distclean
292