aboutsummaryrefslogtreecommitdiff
path: root/winsup/w32api/lib/Makefile.in
blob: e524ec59f9b4481a510b501dd601ef6c5c5fe9ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#
#	Makefile.in
#
#	This file is part of a free library for the Win32 API.
# 
#	This library is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


# start config section

SHELL = @SHELL@

srcdir = @srcdir@
VPATH = @srcdir@

SUBDIRS := ddk directx
subdirs := ddk directx

host_alias = @host@
build_alias = @build@
target_alias = @target@
with_cross_host = @with_cross_host@
prefix = @prefix@
includedir:=@includedir@

program_transform_name = @program_transform_name@
exec_prefix = @exec_prefix@
libdir:=@libdir@
bindir = @bindir@
ifeq ($(target_alias),$(host_alias))
ifeq ($(build_alias),$(host_alias))
tooldir:=$(exec_prefix)
else
tooldir:=$(exec_prefix)/$(target_alias)
endif
else
tooldir:=$(exec_prefix)/$(target_alias)
endif
datadir = @datadir@
infodir = @infodir@
ifneq (,$(findstring cygwin,$(target_alias)))
inst_includedir:=$(tooldir)/include/w32api
inst_libdir:=$(tooldir)/lib/w32api
else
ifneq (,$(with_cross_host))
inst_includedir:=$(tooldir)/include/w32api
inst_libdir:=$(tooldir)/lib
else
inst_includedir:=$(includedir)
inst_libdir:=$(libdir)
endif
endif

INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
mkinstalldirs = mkdir -p

CC = @CC@
CC_FOR_TARGET = $(CC)

DLLTOOL = @DLLTOOL@
DLLTOOL_FLAGS = --as=$(AS) -k
AS = @AS@
AS_FOR_TARGET = $(AS_FOR_TARGET)
WINDRES = @WINDRES@

# Depending on if we build as part of winsup or mingw we need to
# add additional include paths in order to get the correct headers
# from the C library.
BUILDENV = @BUILDENV@

ifeq ($(BUILDENV), cygwin)
# winsup/include
# winsup/../newlib/libc/include
# winsup/../newlib/libc/sys/cygwin
EXTRA_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../../../newlib/libc/include -I$(srcdir)/../../../newlib/libc/sys/cygwin
endif
ifeq ($(BUILDENV), mingw)
EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
endif

INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)

CFLAGS = @CFLAGS@
ALL_CFLAGS = $(CFLAGS) $(INCLUDES)

RANLIB = @RANLIB@
AR = @AR@
LD = @LD@

FLAGS_TO_PASS = \
	AS="$(AS)" \
	CC="$(CC)" \
	CPPFLAGS="$(CPPFLAGS)" \
	CFLAGS="$(CFLAGS)" \
	CXXFLAGS="$(CXXFLAGS)" \
	AR="$(AR)" \
	RANLIB="$(RANLIB)" \
	LD="$(LD)" \
	DLLTOOL="$(DLLTOOL)" \
	TAR="$(TAR)" \
	TARFLAGS="$(TARFLAGS)" \
	TARFILEEXT="$(TARFILEEXT)" \
	WINDRES="$(WINDRES)"

# end config section

# headers

HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
GL_HEADERS = $(notdir $(wildcard $(srcdir)/../include/GL/*.h))
GDIPLUS_HEADERS = $(notdir $(wildcard $(srcdir)/../include/gdiplus/*.h))

# libraries

DEF_FILES = $(notdir $(wildcard $(srcdir)/*.def))
MRI_FILES = $(notdir $(wildcard $(srcdir)/*.mri))
IMPLIBS = $(addprefix lib,$(subst .def,.a,$(DEF_FILES)))
MIMPLIBS = $(addprefix lib,$(subst .mri,.a,$(MRI_FILES)))
EXTRA_LIBS=libuuid.a libscrnsave.a libscrnsavw.a liblargeint.a
LIBS = $(IMPLIBS) $(MIMPLIBS) $(EXTRA_LIBS)
UUID_OBJS = mshtml-uuid.o msxml-uuid.o unknwn-uuid.o \
			servprov-uuid.o oleidl-uuid.o oleacc-uuid.o ocidl-uuid.o \
			objsafe-uuid.o oaidl-uuid.o docobj-uuid.o comcat-uuid.o \
			exdisp-uuid.o mlang-uuid.o objidl-uuid.o cguid-uuid.o \
			olectlid-uuid.o ativscp-uuid.o urlmon-uuid.o hlink-uuid.o \
			hlguids-uuid.o extras-uuid.o devguid.o power-uuid.o
EXTRA_OBJS = shell32.o scrnsave.o scrnsavw.o largeint.o gdiplus.o \
	$(UUID_OBJS) ws2_32.o
UUID_SOURCES = mshtml-uuid.c msxml-uuid.c unknwn-uuid.c \
			   servprov-uuid.c oleidl-uuid.c oleacc-uuid.c ocidl-uuid.c \
			   objsafe-uuid.c oaidl-uuid.c docobj-uuid.c comcat-uuid.c \
			   exdisp-uuid.c mlang-uuid.c objidl-uuid.c cguid-uuid.c \
			   olectlid-uuid.c ativscp-uuid.c urlmon-uuid.c hlink-uuid.c \
			   hlguids-uuid.c extras-uuid.c devguid.c power-uuid.c
SOURCES = scrnsave.c shell32.c  largeint.c gdiplus.c $(UUID_SOURCES) \
res.rc test.c ws2_32.c

DISTFILES = Makefile.in $(DEF_FILES) $(MRI_FILES) $(SOURCES)

.NOTPARALLEL:

# targets
all: $(EXTRA_OBJS) $(LIBS) ddk directx

%-subdirs:
	for i in $(SUBDIRS); do \
	  $(MAKE) $(FLAGS_TO_PASS) -C $$i $*; \
	done

ddk:
	$(MAKE) $(FLAGS_TO_PASS) -C $@

directx:
	$(MAKE) $(FLAGS_TO_PASS) -C $@

TEST_OPTIONS = $(ALL_CFLAGS) -DWINVER=0x0666  \
	-Wall -pedantic -Wsystem-headers -c $(srcdir)/test.c -o test.o
.PHONY: test ddk directx
test:
	@echo "Testing w32api..."
	@for lang in c c++ objective-c ; do \
		echo "$$lang..."; \
		$(CC) -x$$lang $(TEST_OPTIONS) ; \
		echo "$$lang UNICODE..."; \
		$(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
	done
	@echo "windres..."
	@$(WINDRES) --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
	@echo "windres UNICODE..."
	@$(WINDRES) --define UNICODE --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
	@rm -f test.o

scrnsavw.o: scrnsave.c
	$(CC) -c $(ALL_CFLAGS) -DUNICODE -o $@ $<

# make rules

.SUFFIXES: .c .o .def .a

.c.o:
	$(CC) -c $(ALL_CFLAGS) -o $@ $<

libuuid.a : $(UUID_OBJS)
	$(AR) rc $@ $(UUID_OBJS)
	$(RANLIB) $@

# libvfw32.a contains import stubs for 3 dll's.  Using an MRI script
# seems to be the simplest way to combine them into one archive.
# NB: With older dlltool, the object file members will not have unique
# names.
libvfw32.a : vfw32.mri libmsvfw32.a libavifil32.a libavicap32.a
	rm -f $@
	$(AR) -M < ${word 1,$^}
	$(RANLIB) $@

lib%.a : %.def %.o
	$(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
	$(AR) r $@ $*.o
	$(RANLIB) $@

lib%.a: %.def
	$(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<

lib%.a: %.o
	$(AR) rc $@ $*.o
	$(RANLIB) $@

need-DESTDIR-compatibility = prefix libdir includedir
.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility

$(need-DESTDIR-compatibility):
	@test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
	  $(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
	esac

fail-DESTDIR-compatibility:
	$(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
	try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)

.PHONY: install install-libraries install-headers install-ddk
# install headers and libraries in a target specified directory.
install: install-libraries install-headers install-ddk install-directx

install-libraries: all $(need-DESTDIR-compatibility)
	$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
	for i in $(LIBS); do \
		$(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
	done

install-headers: $(need-DESTDIR-compatibility)
	$(mkinstalldirs) $(DESTDIR)$(inst_includedir)
	for i in $(HEADERS); do \
		$(INSTALL_DATA) $(srcdir)/../include/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
	done
	$(mkinstalldirs) $(DESTDIR)$(inst_includedir)/GL
	for i in $(GL_HEADERS); do \
		$(INSTALL_DATA) $(srcdir)/../include/GL/$$i $(DESTDIR)$(inst_includedir)/GL/$$i ; \
	done
	$(mkinstalldirs) $(DESTDIR)$(inst_includedir)/gdiplus
	for i in $(GDIPLUS_HEADERS); do \
		$(INSTALL_DATA) $(srcdir)/../include/gdiplus/$$i $(DESTDIR)$(inst_includedir)/gdiplus/$$i ; \
	done

install-ddk: install-libraries install-headers
	cd ddk && $(MAKE) install $(FLAGS_TO_PASS)

install-directx: install-libraries install-headers
	cd directx && $(MAKE) install $(FLAGS_TO_PASS)

# uninstall headers and libraries from a target specified directory
uninstall: uninstall-ddk uninstall-directx uninstall-libraries uninstall-headers

uninstall-libraries: $(need-DESTDIR-compatibility)
	@for i in $(LIBS); do \
		rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
	done
	rmdir $(DESTDIR)$(inst_libdir)

uninstall-headers: $(need-DESTDIR-compatibility)
	@for i in $(HEADERS); do \
		rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
	done
	rmdir $(DESTDIR)$(inst_includedir)

uninstall-ddk:
	cd ddk && $(MAKE) -C uninstall $(FLAGS_TO_PASS)

uninstall-directx:
	cd directx && $(MAKE) -C uninstall $(FLAGS_TO_PASS)

dist:
	mkdir $(distdir)/include
	chmod 755 $(distdir)/include
	@for i in $(HEADERS); do \
		cp -p $(srcdir)/../include/$$i $(distdir)/include/$$i ; \
	done
	mkdir $(distdir)/include/GL
	@for i in $(GL_HEADERS); do \
		cp -p $(srcdir)/../include/GL/$$i $(distdir)/include/GL/$$i ; \
	done
	mkdir $(distdir)/lib
	chmod 755 $(distdir)/lib
	@for i in $(DISTFILES); do \
		cp -p $(srcdir)/$$i $(distdir)/lib/$$i ; \
	done
	for i in $(SUBDIRS); do \
		(cd $$i; $(MAKE) distdir=../$(distdir) dist); \
	done

Makefile: Makefile.in ../config.status ../configure
	cd ..; $(SHELL) config.status

# clean

mostlyclean:
	rm -f *~ *.o *.s

clean:
	rm -f *.o *.a *.s *~

distclean: clean
	rm -f config.cache config.status config.log Makefile

maintainer-clean: distclean