Makedll.rules.in 4.24 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
# SUBSYSTEM    : (optional) subsystem (for native dlls)
8 9 10 11
#
# plus all variables required by the global Make.rules.in
#

12
DLLFLAGS    = @DLLFLAGS@
13
DLLEXT      = @DLLEXT@
14
IMPLIBEXT   = @IMPLIBEXT@
15
MINGWAR     = @MINGWAR@
16
DEFS        = -D__WINESRC__ $(EXTRADEFS)
17 18 19
BASEMODULE  = $(MODULE:%.dll=%)
MAINSPEC    = $(BASEMODULE).spec
SPEC_DEF    = lib$(BASEMODULE).def
20
WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16)
21
ALL_OBJS    = @WIN16_FILES@ $(OBJS) $(RC_SRCS:.rc=.res)
22
ALL_LIBS    = $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
23 24
IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
STATICIMPLIB= $(IMPORTLIB:.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) $(SUBSYSTEM:%=-Wb,--subsystem,%) $(DLLFILENAME:%=-Wb,-F,%) $(BASEADDRESS:%=-Wl,--image-base,%) -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: $(IMPORTLIB) $(IMPLIB_SRCS:%=__static_implib__%)
47

48
$(IMPLIB_SRCS:%=__static_implib__%): $(STATICIMPLIB)
49 50 51 52 53 54 55 56 57 58

lib$(BASEMODULE).def: $(MAINSPEC)
	$(WINEBUILD) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)

lib$(BASEMODULE).def.a: $(IMPLIB_OBJS)
	$(RM) $@
	$(AR) $@ $(IMPLIB_OBJS)
	$(RANLIB) $@

lib$(BASEMODULE).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 86 87
EXE_SPECS16 = $(SPEC_SRCS16:.exe.spec=.exe16)
DRV_SPECS16 = $(EXE_SPECS16:.drv.spec=.drv16)
ALL_SPECS16 = $(DRV_SPECS16:.spec=.dll16)
88

89
WIN16_INSTALL = $(SPEC_SRCS16:%=_install_/%)
90

91
.PHONY: install_static_implib_def install_static_implib_a
92
.PHONY: $(SPEC_SRCS16:%=_install_/%) $(ALL_SPECS16:%=_install_/%) $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
93

94 95
$(SPEC_SRCS16:%=_install_/%): $(ALL_SPECS16:%=_install_/%)

96
$(ALL_SPECS16:%=_install_/%): $(DESTDIR)$(dlldir) dummy
97
	echo "$(MODULE)" > $(DESTDIR)$(dlldir)/`basename $@`
98

99
$(IMPORTLIB:%=_install_/%): $(IMPORTLIB) $(DESTDIR)$(dlldir) dummy
100
	$(INSTALL_DATA) $(IMPORTLIB) $(DESTDIR)$(dlldir)/$(IMPORTLIB)
101

102
install_static_implib_def: $(STATICIMPLIB) $(DESTDIR)$(dlldir) dummy
103
	$(INSTALL_DATA) $(STATICIMPLIB) $(DESTDIR)$(dlldir)/$(STATICIMPLIB)
104 105 106

install_static_implib_a:

107
$(IMPLIB_SRCS:%=_install_static_implib_/%): install_static_implib_$(IMPLIBEXT)
108

109 110
install install-lib:: $(MODULE)$(DLLEXT) $(DESTDIR)$(dlldir) @WIN16_INSTALL@ dummy
	$(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(DESTDIR)$(dlldir)/$(MODULE)$(DLLEXT)
111

112
install install-dev:: $(IMPORTLIB:%=_install_/%) $(IMPLIB_SRCS:%=_install_static_implib_/%)
113

114
uninstall::
115
	-cd $(DESTDIR)$(dlldir) && $(RM) $(MODULE)$(DLLEXT) $(IMPORTLIB) $(STATICIMPLIB) $(ALL_SPECS16)
116

117 118
# Misc. rules

119 120 121
clean::
	$(RM) $(SPEC_DEF)

122
$(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.o): $(WINEBUILD)
123

124
# End of global dll rules