[SeaBIOS] problem building from Windows using msys

Kevin O'Connor kevin at koconnor.net
Mon Jun 2 17:53:00 CEST 2014

On Sun, Jun 01, 2014 at 10:31:39PM -0500, Scott Duplichan wrote:
> Building SeaBIOS from Windows using mingw has been broken for
> a long time. The problem is that in this environment, line 100
> of the makefile:
>    $(Q)printf '$(foreach i,$2,#include "$(CURDIR)/$i"\n)' > $3.tmp.c
> creates an include statement that the mingw port of gcc rejects:
>    #include "/D/coreboot/build/seabios/src/misc.c"
> Msys converts the Windows drive letter D:\ to a more
> Unix-like /D/. But the mingw port of gcc needs D:\, not /d/.
> While this problem might not be easy to solve, I did find
> a work-around: use relative paths in the include statements
> rather than absolute paths. In other words, change makefile
> line 100 from this:
>    $(Q)printf '$(foreach i,$2,#include "$(CURDIR)/$i"\n)' > $3.tmp.c
> to this:
>    $(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c

Unfortunately, this would break builds where one specifies an OUT
build directory that isn't a sub-directory of the source code.  (That
is, a build with "make OUT=/a/b/c".)

I've never tried building under Windows, and I'm not really sure how
to help here.  Does passing the CURDIR via the command-line (as in the
patch below) improve things?


--- a/Makefile
+++ b/Makefile
@@ -112,8 +112,8 @@ endif
 # Do a whole file compile by textually including all C code.
 define whole-compile
 @echo "  Compiling whole program $3"
-$(Q)printf '$(foreach i,$2,#include "$(CURDIR)/$i"\n)' > $3.tmp.c
-$(Q)$(CC) $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
+$(Q)printf '$(foreach i,$2,#include "$i"\n)' > $3.tmp.c
+$(Q)$(CC) -I$(CURDIR) $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
 %.strip.o: %.o

More information about the SeaBIOS mailing list