Makedll.rules.in 3.82 KB
Newer Older
1 2 3 4
# Global rules for building dlls     -*-Makefile-*-
#
# Each individual makefile should define the following variables:
# MODULE       : name of the main module being built
5
# EXTRALIBS    : extra libraries to link in (optional)
6 7 8 9
#
# plus all variables required by the global Make.rules.in
#

10
DLLFLAGS    = @DLLFLAGS@
11
DEFS        = -D__WINESRC__ $(EXTRADEFS)
12 13
BASEMODULE  = $(MODULE:%.dll=%)
MAINSPEC    = $(BASEMODULE).spec
14
ALL_LIBS    = $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
15
IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
16
IMPLIBFLAGS = $(TARGETFLAGS) $(EXTRAIMPLIBFLAGS)
17
IMPORTLIBFILE = $(IMPORTLIB:%=lib%.@IMPLIBEXT@)
18
STATICIMPLIB  = $(IMPORTLIBFILE:.def=.def.a)
19
DLL_LDPATH  = -L$(DLLDIR) $(DELAYIMPORTS:%=-L$(DLLDIR)/%) $(IMPORTS:%=-L$(DLLDIR)/%)
20
INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(fakedlldir) $(DESTDIR)$(datadir)/wine
21 22 23

@MAKE_RULES@

24
all: $(MODULE)$(DLLEXT) $(MODULE)$(FAKEEXT)
25

26 27
$(MODULE) $(MODULE).so $(MODULE).fake: $(MAINSPEC) $(OBJS) Makefile.in
	$(WINEGCC) -shared $(SRCDIR)/$(MAINSPEC) $(OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
28

29 30
# Rules for import libraries

31 32
IMPLIB_CROSSOBJS = $(IMPLIB_OBJS:.o=.cross.o)

33
.PHONY: $(IMPLIB_SRCS:%=__static_implib__%)
34

35
all: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
36

37
$(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
38

39 40
$(IMPORTLIB:%=lib%.def): $(MAINSPEC)
	$(WINEBUILD) $(IMPLIBFLAGS) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
41

42
$(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
43
	$(RM) $@
44
	$(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
45 46
	$(RANLIB) $@

47
$(IMPORTLIB:%=lib%.a): $(MAINSPEC) $(IMPLIB_OBJS)
48 49 50 51
	$(WINEBUILD) $(IMPLIBFLAGS) -w --implib -o $@ --export $(SRCDIR)/$(MAINSPEC) $(IMPLIB_OBJS)

$(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_CROSSOBJS)
	$(WINEBUILD) $(IMPLIBFLAGS) $(CROSSTARGET:%=-b %) -w --implib -o $@ --export $(SRCDIR)/$(MAINSPEC) $(IMPLIB_CROSSOBJS)
52

53 54
# Rules for auto documentation

55
man: $(C_SRCS) dummy
56
	$(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(C_SRCS)
57

58
doc-html: $(C_SRCS) dummy
59
	$(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(C_SRCS)
60

61
doc-sgml: $(C_SRCS) dummy
62
	$(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(C_SRCS)
63

64
doc-xml: $(C_SRCS) dummy
65
	$(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide-xml -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Tx $(MAINSPEC:%=-w %) $(C_SRCS)
66 67

.PHONY: man doc-html doc-sgml doc-xml
68

69 70
# Rules for installation

71
.PHONY: install_static_implib_def install_static_implib_a
72
.PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
73

74 75
$(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
	$(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
76

77
install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
78
	$(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
79 80 81

install_static_implib_a:

82
$(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
83

84 85 86 87 88 89 90 91 92 93 94 95
.PHONY: install_dll install_dll.so install_dll.fake

install_dll: $(MODULE) $(DESTDIR)$(dlldir) dummy
	$(INSTALL_PROGRAM) $(MODULE) $(DESTDIR)$(dlldir)/$(MODULE)

install_dll.so: $(MODULE).so $(DESTDIR)$(dlldir) dummy
	$(INSTALL_PROGRAM) $(MODULE).so $(DESTDIR)$(dlldir)/$(MODULE).so

install_dll.fake: $(MODULE).fake $(DESTDIR)$(fakedlldir) dummy
	$(INSTALL_DATA) $(MODULE).fake $(DESTDIR)$(fakedlldir)/$(MODULE)

install install-lib:: install_dll$(DLLEXT) install_dll$(FAKEEXT)
96

97
install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%) dummy
98

99
uninstall::
100
	-cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
101
	$(RM) $(DESTDIR)$(fakedlldir)/$(MODULE)
102

103 104
# Misc. rules

105
clean::
106
	$(RM) $(IMPORTLIBFILE)
107

108
# End of global dll rules