1 # dll.mk - auxilary Makefile to easy build dll's for mingw32 target
2 # ver. 0.6 of 1999-03-25
4 # Homepage of this makefile - http://www.is.lg.ua/~paul/devel/
5 # Homepage of original mingw32 project -
6 # http://www.fu.is.saga-u.ac.jp/~colin/gcc.html
10 # 1. Create automatical .def file from list of objects
11 # 2. Create .dll from objects and .def file, either automatical, or your
12 # hand-written (maybe) file, which must have same basename as dll
13 # WARNING! There MUST be object, which name match dll's name. Make sux.
14 # 3. Create import library from .def (as for .dll, only its name required,
16 # By convention implibs for dll have .dll.a suffix, e.g. libstuff.dll.a
17 # Why not just libstuff.a? 'Cos that's name for static lib, ok?
18 # Process divided into 3 phases because:
19 # 1. Pre-existent .def possible
20 # 2. Generating implib is enough time-consuming
23 # DLL_LDLIBS - libs for linking dll
24 # DLL_LDFLAGS - flags for linking dll
26 # By using $(DLL_SUFFIX) instead of 'dll', e.g. stuff.$(DLL_SUFFIX)
27 # you may help porting makefiles to other platforms
29 # Put this file in your make's include path (e.g. main include dir, for
30 # more information see include section in make doc). Put in the beginning
31 # of your own Makefile line "include dll.mk". Specify dependences, e.g.:
33 # Do all stuff in one step
34 # libstuff.dll.a: $(OBJECTS) stuff.def
35 # stuff.def: $(OBJECTS)
37 # Steps separated, pre-provided .def, link with user32
40 # stuff.dll: $(OBJECTS)
41 # libstuff.dll.a: $(OBJECTS)
49 .SUFFIXES: .o .$(DLL_SUFFIX)
52 $(DLLTOOL) --export-all --output-def $@ $^
55 $(DLLWRAP) --dllname $(notdir $@) --driver-name $(CC) --def $*.def -o $@ $(filter %.o,$^) $(DLL_LDFLAGS) $(DLL_LDLIBS)
57 lib%.$(DLL_SUFFIX).a:%.def
58 $(DLLTOOL) --dllname $(notdir $*.dll) --def $< --output-lib $@