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 | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 6 | # IMPORTS : dlls to import (optional) |
Alexandre Julliard | e1e7537 | 2000-04-24 17:17:49 +0000 | [diff] [blame] | 7 | # EXTRALIBS : extra libraries to link in (optional) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 8 | # |
| 9 | # plus all variables required by the global Make.rules.in |
| 10 | # |
| 11 | |
Francois Gouget | b9ca58f | 2001-04-10 23:22:22 +0000 | [diff] [blame] | 12 | DEFS = @DLLFLAGS@ -D__WINE__ $(EXTRADEFS) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 13 | LIBEXT = @LIBEXT@ |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 14 | SONAME = lib$(MODULE).so |
| 15 | IMPORTLIBS = $(IMPORTS:%=$(DLLDIR)/lib%.$(LIBEXT)) |
Alexandre Julliard | 82a2b18 | 2000-03-05 13:08:24 +0000 | [diff] [blame] | 16 | ALLNAMES = lib$(MODULE).so $(ALTNAMES:%=lib%.so) |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 17 | SPEC_SRCS = $(ALTNAMES:%=%.spec) |
Alexandre Julliard | 218188c | 2000-12-02 20:38:47 +0000 | [diff] [blame] | 18 | ALL_OBJS = $(MODULE).spec.o $(OBJS) |
Alexandre Julliard | e2222fd | 2000-12-06 00:05:14 +0000 | [diff] [blame] | 19 | ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 20 | |
Alexandre Julliard | 82a2b18 | 2000-03-05 13:08:24 +0000 | [diff] [blame] | 21 | all: lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT)) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 22 | |
| 23 | @MAKE_RULES@ |
| 24 | |
Alexandre Julliard | 82a2b18 | 2000-03-05 13:08:24 +0000 | [diff] [blame] | 25 | # Rules for .so files |
| 26 | |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 27 | lib$(MODULE).so: $(ALL_OBJS) Makefile.in |
| 28 | $(LDSHARED) $(LDDLLFLAGS) $(ALL_OBJS) -o $@ -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 29 | |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 30 | $(ALTNAMES:%=lib%.$(LIBEXT)): lib$(MODULE).$(LIBEXT) |
| 31 | $(RM) $@ && $(LN_S) lib$(MODULE).$(LIBEXT) $@ |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 32 | |
Alexandre Julliard | 82a2b18 | 2000-03-05 13:08:24 +0000 | [diff] [blame] | 33 | # Rules for .a files |
| 34 | |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 35 | lib$(MODULE).a: $(ALL_OBJS) Makefile.in |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 36 | $(RM) $@ |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 37 | $(AR) $@ $(ALL_OBJS) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 38 | $(RANLIB) $@ |
| 39 | |
Hidenori Takeshima | d48ca94 | 2000-12-22 22:28:00 +0000 | [diff] [blame] | 40 | # Rules for .dll files |
| 41 | lib$(MODULE).dll: $(ALL_OBJS) Makefile.in |
| 42 | $(DLLWRAP) $(DLLWRAPFLAGS) --implib lib$(MODULE).a -o lib$(MODULE).dll $(ALL_OBJS) -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS) |
| 43 | |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 44 | # Rules for checking that no imports are missing |
| 45 | |
Alexandre Julliard | 6c9d83a | 2000-08-03 00:04:24 +0000 | [diff] [blame] | 46 | checklink:: lib$(MODULE).$(LIBEXT) |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 47 | $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) $(ALL_LIBS) && $(RM) checklink |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 48 | |
Alexandre Julliard | eb58e1d | 2000-11-05 04:53:07 +0000 | [diff] [blame] | 49 | # Rules for debug channels |
| 50 | |
| 51 | debug_channels: dummy |
| 52 | $(TOPSRCDIR)/tools/make_debug $(MODULE).spec $(C_SRCS) $(SUBDIRS:%=%/*.c) |
| 53 | |
Marcus Meissner | b7175df | 2001-05-07 18:22:43 +0000 | [diff] [blame^] | 54 | # Sanity check |
| 55 | |
| 56 | Makedll.rules: $(TOPSRCDIR)/Makedll.rules.in $(TOPSRCDIR)/configure |
| 57 | @echo $? is newer than 'Makedll.rules', please rerun ./configure! |
| 58 | @exit 1 |
| 59 | |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 60 | # Rules for installation |
| 61 | |
| 62 | .PHONY: install_so install_a |
| 63 | |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 64 | $(ALTNAMES:%=_install_/lib%.$(LIBEXT)): $(LIBEXT:%=install_%) |
| 65 | cd $(libdir) && $(RM) `basename $@` && $(LN_S) lib$(MODULE).$(LIBEXT) `basename $@` |
| 66 | |
| 67 | install_so: lib$(MODULE).so |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 68 | [ -d $(libdir) ] || $(MKDIR) $(libdir) |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 69 | $(INSTALL_PROGRAM) lib$(MODULE).so $(libdir)/lib$(MODULE).so |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 70 | |
| 71 | install_a: lib$(MODULE).a |
| 72 | [ -d $(libdir) ] || $(MKDIR) $(libdir) |
| 73 | $(INSTALL_DATA) lib$(MODULE).a $(libdir)/lib$(MODULE).a |
| 74 | |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 75 | install:: $(LIBEXT:%=install_%) $(ALTNAMES:%=_install_/lib%.$(LIBEXT)) |
Alexandre Julliard | d0edc5f | 2000-03-04 22:31:27 +0000 | [diff] [blame] | 76 | |
| 77 | uninstall:: |
Alexandre Julliard | 64e0ded | 2000-11-10 20:35:39 +0000 | [diff] [blame] | 78 | cd $(libdir) && $(RM) lib$(MODULE).$(LIBEXT) $(ALTNAMES:%=lib%.$(LIBEXT)) |