From: Marius Storm-Olsen Date: Tue, 18 Aug 2009 17:38:15 GMT Subject: Re: [RFC] Enable compilation by Makefile for the MSVC toolchain Message-ID: <4A8AE707.9010202@gmail.com> In-Reply-To: Daniel Barkalow said the following on 18.08.2009 18:51: > On Tue, 18 Aug 2009, Marius Storm-Olsen wrote: > >> From: Marius Storm-Olsen >> >> By using GNU Make we can also compile with the MSVC toolchain. >> This is a rudementary patch, only meant as an RFC for now!! >> >> !! DO NOT COMMIT THIS UPSTREAM !! >> --- >> So, instead of rely on these vcproj files which *will* go stale, we can >> simply use the same Makefile system which everyone else is using. :) >> After all, we're just compiling with a different compiler. The end result >> will still rely on the *msysGit environment* to function, so we already >> require it. Thus, GNU Make is present, and we can use it. >> >> This implementation is a quick hack to make it compile (hence the RFC >> subject), so please don't even consider basing anything ontop of it ;) >> >> But, do point out all the do's and don'ts, and I'll try to polish it up >> to something which we can add to Frank's series.. >> >> >> Makefile | 97 +++++++++++++++++++++++++++++++++++++++++++++++--------- >> compat/msvc.h | 77 +++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 158 insertions(+), 16 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index daf4296..2e14976 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -214,9 +214,13 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') >> >> CFLAGS = -g -O2 -Wall >> LDFLAGS = >> +ARFLAGS = rcs\ # whitespace intentional >> ALL_CFLAGS = $(CFLAGS) >> ALL_LDFLAGS = $(LDFLAGS) >> STRIP ?= strip >> +COMPFLAG = -c >> +COBJFLAG = -o\ # whitespace intended >> +LOBJFLAG = -o\ # whitespace intended > > I think it's nicer to write the significant whitespace with non-whitespace > text using something like: > > empty= > space=$(empty) $(empty) > > (...) > > ARFLAGS = rcs$(space) > > COBJFLAG = -o$(space) > > On the other hand, I think it would be clearer to put the "rcs" in the > default version of $(AR), and have a $(AROBJFLAG) set to nothing there, > since the "rcs" isn't actually at all like the "-OUT:" with respect to > what it's doing there. > > Possibly also to have two variables for the output of the toolchain > wrapper, one that is before the name of the file and one that's attached > to the name of the file. I agree on all accounts. If we don't go for a wrapper script, as Junio suggested, then I'll definitely do it like you suggested. -- .marius