Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 1 | # Global rules for building dlls -*-Makefile-*- |
| 2 | # |
| 3 | # Each individual makefile should define the following variables: |
| 4 | # MODULE : name of the main module being built |
Alexandre Julliard | 82a2b18 | 2000-03-05 13:08:24 +0000 | [diff] [blame] | 5 | # ALTNAMES : alternate names for this dll (optional) |
Alexandre Julliard | e1e7537 | 2000-04-24 17:17:49 +0000 | [diff] [blame] | 6 | # EXTRALIBS : extra libraries to link in (optional) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 7 | # |
| 8 | # plus all variables required by the global Make.rules.in |
| 9 | # |
| 10 | |
Alexandre Julliard | 3245991 | 2002-05-09 00:05:48 +0000 | [diff] [blame] | 11 | DEFS = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS) |
| 12 | DLLEXT = @DLLEXT@ |
| 13 | ALTSPECS = $(ALTNAMES:%.dll=%) |
| 14 | SPEC_SRCS = $(ALTSPECS:%=%.spec) |
Alexandre Julliard | 67371bc | 2002-05-11 23:06:32 +0000 | [diff] [blame] | 15 | MAINSPEC = $(MODULE:%.dll=%).spec |
| 16 | SPEC_DEF = $(MAINSPEC).def |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 17 | WIN16_FILES = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS16:.c=.o) $(EXTRA_OBJS16) |
| 18 | ALL_OBJS = @WIN16_FILES@ $(OBJS) $(MODULE).dbg.o |
Alexandre Julliard | 3245991 | 2002-05-09 00:05:48 +0000 | [diff] [blame] | 19 | ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS) |
Alexandre Julliard | 309fde7 | 2002-12-13 20:45:39 +0000 | [diff] [blame] | 20 | IMPORTLIBS = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 21 | |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 22 | all: $(MODULE)$(DLLEXT) $(SUBDIRS) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 23 | |
| 24 | @MAKE_RULES@ |
| 25 | |
Alexandre Julliard | 82a2b18 | 2000-03-05 13:08:24 +0000 | [diff] [blame] | 26 | # Rules for .so files |
| 27 | |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 28 | $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(IMPORTLIBS) $(WINEBUILD) |
Alexandre Julliard | 310de88 | 2002-12-06 23:26:29 +0000 | [diff] [blame] | 29 | $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=-e %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%) |
Alexandre Julliard | 526531e | 2002-08-01 18:36:58 +0000 | [diff] [blame] | 30 | |
| 31 | $(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in |
Alexandre Julliard | 1550044 | 2002-11-21 03:47:45 +0000 | [diff] [blame] | 32 | $(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc |
Alexandre Julliard | 526531e | 2002-08-01 18:36:58 +0000 | [diff] [blame] | 33 | |
| 34 | $(MODULE).tmp.o: $(ALL_OBJS) Makefile.in |
| 35 | $(LDCOMBINE) $(ALL_OBJS) -o $@ |
| 36 | -$(STRIP) --strip-unneeded $@ |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 37 | |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 38 | # Rule for 16-bit glue |
| 39 | |
| 40 | $(MODULE).glue.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD) |
Alexandre Julliard | 910851a | 2002-11-06 20:02:59 +0000 | [diff] [blame] | 41 | $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --glue -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 42 | |
Hidenori Takeshima | d48ca94 | 2000-12-22 22:28:00 +0000 | [diff] [blame] | 43 | # Rules for .dll files |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 44 | |
Alexandre Julliard | ada5e65 | 2002-12-12 22:03:14 +0000 | [diff] [blame] | 45 | $(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) $(IMPORTLIBS) Makefile.in |
| 46 | $(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS) |
Alexandre Julliard | 67371bc | 2002-05-11 23:06:32 +0000 | [diff] [blame] | 47 | |
| 48 | $(SPEC_DEF): $(WINEBUILD) |
Hidenori Takeshima | d48ca94 | 2000-12-22 22:28:00 +0000 | [diff] [blame] | 49 | |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 50 | # Rules for checking that no imports are missing |
| 51 | |
Alexandre Julliard | 4b9344e | 2002-09-25 03:29:55 +0000 | [diff] [blame] | 52 | CHECKLINK_RPATH = dlls library unicode |
Alexandre Julliard | 3536316 | 2002-05-22 21:32:49 +0000 | [diff] [blame] | 53 | |
Alexandre Julliard | 0d6eba7 | 2002-10-29 23:14:11 +0000 | [diff] [blame] | 54 | .PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%) |
| 55 | |
| 56 | $(WIN16_FILES:%=__checklink16__%): checklink16 |
| 57 | |
| 58 | checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 59 | $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) && $(RM) checklink |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 60 | |
Alexandre Julliard | e0c6370c | 2002-11-30 19:19:44 +0000 | [diff] [blame] | 61 | checklink:: $(WIN16_FILES:%=__checklink16__%) |
Alexandre Julliard | 0d6eba7 | 2002-10-29 23:14:11 +0000 | [diff] [blame] | 62 | |
Alexandre Julliard | 13b0c09 | 2002-01-10 03:30:21 +0000 | [diff] [blame] | 63 | # Rules for testing |
| 64 | |
Alexandre Julliard | edeee89 | 2002-08-09 01:22:40 +0000 | [diff] [blame] | 65 | check test:: $(SUBDIRS:%=%/__test__) |
| 66 | |
Alexandre Julliard | c3c587e | 2002-09-06 19:46:00 +0000 | [diff] [blame] | 67 | crosstest:: $(SUBDIRS:%=%/__crosstest__) |
| 68 | |
Marcus Meissner | b7175df | 2001-05-07 18:22:43 +0000 | [diff] [blame] | 69 | # Sanity check |
| 70 | |
Alexandre Julliard | 309fde7 | 2002-12-13 20:45:39 +0000 | [diff] [blame] | 71 | Makedll.rules: $(TOPSRCDIR)/dlls/Makedll.rules.in $(TOPSRCDIR)/configure |
Marcus Meissner | b7175df | 2001-05-07 18:22:43 +0000 | [diff] [blame] | 72 | @echo $? is newer than 'Makedll.rules', please rerun ./configure! |
Alexandre Julliard | 7cae558 | 2002-06-01 02:55:48 +0000 | [diff] [blame] | 73 | @exit 1 |
Marcus Meissner | b7175df | 2001-05-07 18:22:43 +0000 | [diff] [blame] | 74 | |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 75 | # Rules for installation |
| 76 | |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 77 | WIN16_INSTALL = $(ALTNAMES:%=_install_/%$(DLLEXT)) |
| 78 | |
| 79 | .PHONY: install_lib $(WIN16_INSTALL) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 80 | |
Alexandre Julliard | c1bfca0 | 2002-03-20 22:19:06 +0000 | [diff] [blame] | 81 | $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib |
| 82 | cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@` |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 83 | |
Alexandre Julliard | c1bfca0 | 2002-03-20 22:19:06 +0000 | [diff] [blame] | 84 | install_lib: $(MODULE)$(DLLEXT) |
Alexandre Julliard | ce830a9 | 2002-05-09 04:31:39 +0000 | [diff] [blame] | 85 | $(MKINSTALLDIRS) $(dlldir) |
Alexandre Julliard | c1bfca0 | 2002-03-20 22:19:06 +0000 | [diff] [blame] | 86 | $(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 87 | |
Alexandre Julliard | c728efc | 2002-10-02 02:34:09 +0000 | [diff] [blame] | 88 | install:: install_lib @WIN16_INSTALL@ |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 89 | |
| 90 | uninstall:: |
Alexandre Julliard | c1bfca0 | 2002-03-20 22:19:06 +0000 | [diff] [blame] | 91 | $(RM) $(dlldir)/$(MODULE)$(DLLEXT) $(ALTNAMES:%=$(dlldir)/%$(DLLEXT)) |
| 92 | |
Alexandre Julliard | f33f7f0 | 2001-09-17 20:09:08 +0000 | [diff] [blame] | 93 | # End of global dll rules |