Makedll.rules.in 3.81 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
# SPEC_SRCS16  : interface definition files for 16-bit dlls (optional)
7 8 9 10
#
# plus all variables required by the global Make.rules.in
#

11
DLLFLAGS    = @DLLFLAGS@
12
DLLEXT      = @DLLEXT@
13
IMPLIBEXT   = @IMPLIBEXT@
14
MINGWAR     = @MINGWAR@
15
DEFS        = -D__WINESRC__ $(EXTRADEFS)
16 17
BASEMODULE  = $(MODULE:%.dll=%)
MAINSPEC    = $(BASEMODULE).spec
18
SPEC_DEF    = $(BASEMODULE).def
19
WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
20
ALL_OBJS    = @WIN16_FILES@ $(OBJS) $(RC_SRCS:.rc=.res)
21
ALL_LIBS    = $(LIBPORT) $(EXTRALIBS) $(LDFLAGS) $(LIBS)
22
IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
23 24
IMPORTLIBFILE = $(IMPORTLIB:%=lib%.$(IMPLIBEXT))
STATICIMPLIB  = $(IMPORTLIBFILE:.def=.def.a)
25
DLL_LDPATH  = -L$(DLLDIR) $(DELAYIMPORTS:%=-L$(DLLDIR)/%) $(IMPORTS:%=-L$(DLLDIR)/%)
26
INSTALLDIRS = $(DESTDIR)$(dlldir) $(DESTDIR)$(datadir)/wine
27

28
all: $(MODULE)$(DLLEXT) $(SUBDIRS)
29 30 31

@MAKE_RULES@

32
# Rules for .so files
33

34
$(MODULE).so: $(MAINSPEC) $(ALL_OBJS) Makefile.in
35
	$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) $(ALL_OBJS) $(EXTRADLLFLAGS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
36

37
# Rules for .dll files
38

39
$(MODULE): $(RCOBJS) $(OBJS) $(SPEC_DEF) Makefile.in
40
	$(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(DLL_LDPATH) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(LIBWINE) $(ALL_LIBS)
41

42 43
# Rules for import libraries

44
.PHONY: implib $(IMPLIB_SRCS:%=__static_implib__%)
45

46
all implib: $(IMPORTLIBFILE) $(IMPLIB_SRCS:%=__static_implib__%)
47

48
$(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
49

50
$(SPEC_DEF) $(IMPORTLIB:%=lib%.def): $(MAINSPEC)
51
	$(WINEBUILD) $(TARGETFLAGS) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
52

53
$(IMPORTLIB:%=lib%.def.a): $(IMPLIB_OBJS)
54
	$(RM) $@
55
	$(AR) $(ARFLAGS) $@ $(IMPLIB_OBJS)
56 57
	$(RANLIB) $@

58
$(IMPORTLIB:%=lib%.a): $(SPEC_DEF) $(IMPLIB_OBJS)
59
	$(DLLTOOL) -k -l $@ -d $(SPEC_DEF)
60
	$(MINGWAR) rs $@ $(IMPLIB_OBJS)
61

62 63
$(SUBDIRS): implib

64 65
# Rules for testing

66 67
check test:: $(SUBDIRS:%=%/__test__)

68 69
crosstest:: $(SUBDIRS:%=%/__crosstest__)

70 71
# Rules for auto documentation

72
man: $(C_SRCS) dummy
73
	$(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
74

75
doc-html: $(C_SRCS) dummy
76
	$(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
77

78
doc-sgml: $(C_SRCS) dummy
79
	$(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) -C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
80

81
.PHONY: man doc-html doc-sgml
82

83 84
# Rules for installation

85
.PHONY: install_static_implib_def install_static_implib_a
86
.PHONY: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
87

88 89
$(IMPORTLIB:%=_install_/%): $(IMPORTLIBFILE) $(DESTDIR)$(dlldir) dummy
	$(INSTALL_DATA) $(IMPORTLIBFILE) $(DESTDIR)$(dlldir)/$(IMPORTLIBFILE)
90

91
install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
92
	$(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
93 94 95

install_static_implib_a:

96
$(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
97

98
install install-lib:: $(MODULE)$(DLLEXT) $(DESTDIR)$(dlldir) dummy
99
	$(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(DESTDIR)$(dlldir)/$(MODULE)$(DLLEXT)
100

101
install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
102

103
uninstall::
104
	-cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIBFILE) $(STATICIMPLIB)
105

106 107
# Misc. rules

108
clean::
109
	$(RM) $(SPEC_DEF) $(IMPORTLIBFILE)
110

111
$(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.o): $(WINEBUILD)
112

113
# End of global dll rules