|
34 | 34 | # SO_MINOR_VERSION Minor version number to use for shared library
|
35 | 35 | # (If you want a patchlevel, include it in SO_MINOR_VERSION, e.g., "6.2".)
|
36 | 36 | #
|
37 |
| -# Optional flags when building DLL's (only applicable to win32 and cygwin |
38 |
| -# platforms). |
39 |
| -# DLLTOOL_DEFFLAGS Additional flags when creating the dll .def file |
40 |
| -# DLLTOOL_LIBFLAGS Additional flags when creating the lib<module>.a file |
41 |
| -# DLLWRAP_FLAGS Additional flags to dllwrap |
42 |
| -# |
43 | 37 | # The module Makefile must also include
|
44 | 38 | # $(top_builddir)/src/Makefile.global before including this file.
|
45 | 39 | # (Makefile.global sets PORTNAME and other needed symbols.)
|
@@ -358,35 +352,40 @@ endif # PORTNAME == aix
|
358 | 352 |
|
359 | 353 | else # PORTNAME == cygwin || PORTNAME == win32
|
360 | 354 |
|
361 |
| -# Cygwin or Win32 case |
362 |
| - |
363 |
| -# If SHLIB_EXPORTS is set, the rules below will build a .def file from |
364 |
| -# that. Else we build a temporary one here. |
365 | 355 | ifeq ($(PORTNAME), cygwin)
|
| 356 | + |
| 357 | +# Cygwin case |
| 358 | + |
366 | 359 | $(shlib): $(OBJS) | $(SHLIB_PREREQS)
|
367 | 360 | $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
|
368 | 361 |
|
369 | 362 | $(stlib): $(OBJS) | $(SHLIB_PREREQS)
|
370 | 363 | $(LINK.static) $@ $^
|
371 | 364 | $(RANLIB) $@
|
372 | 365 |
|
373 |
| - |
374 | 366 | else
|
375 |
| -ifeq (,$(SHLIB_EXPORTS)) |
376 |
| -DLL_DEFFILE = lib$(NAME)dll.def |
377 |
| -exports_file = $(DLL_DEFFILE) |
378 | 367 |
|
379 |
| -$(exports_file): $(OBJS) |
380 |
| - $(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $@ $^ |
| 368 | +# Win32 case |
| 369 | + |
| 370 | +# There is no correct way to write a rule that generates two files. |
| 371 | +# Rules with two targets don't have that meaning, they are merely |
| 372 | +# shorthand for two otherwise separate rules. To be safe for parallel |
| 373 | +# make, we must chain the dependencies like this. The semicolon is |
| 374 | +# important, otherwise make will choose some built-in rule. |
| 375 | + |
| 376 | +$(stlib): $(shlib) ; |
| 377 | + |
| 378 | +# If SHLIB_EXPORTS is set, the rules below will build a .def file from that. |
| 379 | +# Else we just use --export-all-symbols. |
| 380 | +ifeq (,$(SHLIB_EXPORTS)) |
| 381 | +$(shlib): $(OBJS) | $(SHLIB_PREREQS) |
| 382 | + $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) |
381 | 383 | else
|
382 | 384 | DLL_DEFFILE = lib$(NAME)dll.def
|
383 |
| -endif |
384 | 385 |
|
385 | 386 | $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
|
386 |
| - $(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) |
387 |
| - |
388 |
| -$(stlib): $(shlib) $(DLL_DEFFILE) | $(SHLIB_PREREQS) |
389 |
| - $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@ |
| 387 | + $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(DLL_DEFFILE) -Wl,--out-implib=$(stlib) |
| 388 | +endif |
390 | 389 |
|
391 | 390 | endif # PORTNAME == cgywin
|
392 | 391 | endif # PORTNAME == cygwin || PORTNAME == win32
|
|
0 commit comments