public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Ross Johnson <Ross.Johnson@homemail.com.au>
To: pthreads-win32@sourceware.org
Subject: Re: [PATCH] Makefile fixes
Date: Sat, 11 Aug 2012 08:06:00 -0000	[thread overview]
Message-ID: <50261284.3050709@homemail.com.au> (raw)
In-Reply-To: <alpine.DEB.2.02.1207101536010.20196@clave.na.sas.com>

After some off-list collaboration pretty much all of these changes have 
been applied now, although some are optional, e.g. by way of 
uncommenting the makefiles in places etc., in particular the static 
linking of libgcc etc. with the rationale being to maintain consistency 
with existing use.

In addition to these, static linked builds have been fixed with patches 
again from Daniel. The autostatic.c code was not being linked in.

Thanks.

On 11/07/2012 6:56 AM, Daniel Richard G. wrote:
> Hello list,
>
> I have a series of patches to contribute to pthreads-win32. This is 
> the first one.
>
> The attached patch, against the CVS source, does the following:
>
> * Factors out the long lists of object and source files and object
>   dependencies into common.mk (also attached as I can't do "cvs add"),
>   which is now included by Bmakefile, GNUmakefile and Makefile. Variables
>   are used to address the different object/resource file extensions.
>
>   I had noticed inconsistencies among the lists of objects/sources in 
> each
>   of the three makefiles, so this approach will put an end to that.
>
> * Fixes incorrect flags/objects used for building the static library
>
> * Adjusts some compiler flags to facilitate building and testing the
>   library
>
> * Adds targets (all-tests, all-tests-cflags) to run the test suite on all
>   of the library's build configurations, as these tend to have different
>   codepaths that can significantly affect correctness
>
> * "Make" syntax tweaks
>
>
> Below is a more detailed walk-through of the changes:
>
> ++ Bmakefile
>
> @ Factored out common variable definitions into common.mk
>
> @ Use new RESOURCE_OBJS variable instead of a literal "version.res"
>
> @ Factored out common dependencies into common.mk
>
>   Added end-of-file comment
>
> ++ GNUmakefile
>
> @ I had trouble with test programs not running because DLLs for
>   libgcc/libstdc++/libgomp were not in the PATH, so these flags will link
>   them statically. (As MinGW is intended to produce "standalone" 
> binaries,
>   this is what most people will probably want to do anyway)
>
> @ MAKE is already set by the Make program
>
>   Factored out common variable definitions into common.mk
>
>   As GNU Make supports "+=", use this to add RESOURCE_OBJS to the three
>   object-file-list variables
>
> @ Use $(MAKE), not "make" in the help text (e.g. MAKE could be "gmake")
>
>   New all-tests and all-tests-cflags targets (note that the latter is 
> less
>   useful for MinGW compared to MSVC)
>
> @ Static builds use small objects, not inlined/aggregate ones, so
>   -DPTW32_BUILD_INLINED doesn't belong here
>
> @ Likewise, static builds should use SMALL_STATIC_OBJS, not
>   DLL_INLINED_OBJS
>
> @ Factored out common dependencies into common.mk
>
>   Added end-of-file comment
>
> ++ Makefile
>
> @ Factored out common variable definitions into common.mk
>
> @ Removed "@" prefix from $(MAKE) invocations in the "all" target, as 
> that
>   suppressed useful information (e.g. if you're redirecting terminal 
> output
>   to a file for later review)
>
>   New all-tests and all-tests-cflags targets (the latter covers both /MD
>   and /MT configurations)
>
> @ Static builds use small objects, not inlined/aggregate ones, so
>   -DPTW32_BUILD_INLINED doesn't belong here
>
> @ Fixed "install" rule for static builds (no *.dll file)
>
> @ Added new RESOURCE_OBJS variable where needed
>
>   Static builds should use SMALL_STATIC_OBJS, not DLL_INLINED_OBJS
>
> @ Factored out common dependencies into common.mk
>
>   Added end-of-file comment
>
> ++ tests/GNUmakefile
>
> @ ECHO should be defined without the "@", as that is already given in the
>   target recipes
>
>   Define TOUCH so that it uses ECHO
>
>   Define ECHO before TOUCH, for ordering
>
>   Don't define MAKE, because that should be set by the Make program 
> itself
>
> @ New variable XLIBS, to specify system/third-party libraries needed by
>   some tests
>
>   Only a couple of tests need -lws2_32 -lgomp; don't add these libs to
>   everything if we can help it
>
>   Use -static-libgcc and PTW32_FLAGS in CFLAGS, to avoid a dynamic
>   dependency on libgcc and build with the same flags as the ptw32 library
>
> @ Replaced "make" with $(MAKE), and a nice straight margin for the target
>   descriptions
>
> @ Only one test needs -fopenmp; don't add it to everything
>
>   Added -static-libstdc++ where useful
>
> @ Normalized use of $(ECHO): prefixed by "@", and argument is 
> double-quoted
>
>   Add -lws2_32, -fopenmp et al. only to the tests that need them, 
> using GNU
>   Make magic
>
> @ Show the compiler invocations directly
>
>   The -lsupc++ bit only caused errors on my system
>
>   XLIBS is used here
>
> @ idem
>
> ++ tests/Makefile
>
> @ Define TOUCH so that it uses ECHO
>
>   Define ECHO before TOUCH, for ordering
>
> @ Use $(MAKE), not "nmake" in the help text
>
> @ Use /nologo in the various $(MAKE) invocations to get rid of annoying
>   Microsoft boilerplate
>
>   Show the compiler invocations directly
>
>
> --Daniel
>
>

      reply	other threads:[~2012-08-11  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 20:57 Daniel Richard G.
2012-08-11  8:06 ` Ross Johnson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50261284.3050709@homemail.com.au \
    --to=ross.johnson@homemail.com.au \
    --cc=pthreads-win32@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).