aboutsummaryrefslogtreecommitdiff
path: root/bootstrap.gmake
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-10-19 14:30:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-10-19 14:30:44 +0200
commita0e862ef2e3fcbb0c3936cb6c0c2548aa666e906 (patch)
tree3b8c00d7837bf43959757c4b66aa60f0f2da849a /bootstrap.gmake
parentb81ced1702bdf6323a6fa438f506008cc65f3ffc (diff)
Add support for MinGW bootstrap using bootstrap.gmake makefile
Diffstat (limited to 'bootstrap.gmake')
-rw-r--r--bootstrap.gmake26
1 files changed, 20 insertions, 6 deletions
diff --git a/bootstrap.gmake b/bootstrap.gmake
index 980b90e..055504b 100644
--- a/bootstrap.gmake
+++ b/bootstrap.gmake
@@ -22,6 +22,9 @@
# cd build2-boot
# make -f ../build2-X.Y.Z/bootstrap.gmake -j 8 CXX=g++-7
#
+# If used on Windows, then this makefile assumes you are building in the
+# MinGW environment and sets things up similar to bootstrap-mingw.bat.
+#
# The following standard make variables can be used to customize the build:
#
# CXX
@@ -30,6 +33,19 @@
# LDFLAGS
# LIBS
+exe :=
+host :=
+chost :=
+
+ifeq ($(OS),Windows_NT)
+ exe := .exe
+ host := i686-w64-mingw32
+ chost := i686-w64-mingw32
+ override LIBS += -limagehlp
+else
+ override LIBS += -lpthread
+endif
+
# Remove all the built-in rules, enable second expansion, etc.
#
.SUFFIXES:
@@ -91,8 +107,6 @@ endif
# Obtain the host triplet.
#
-host :=
-chost :=
ifeq ($(host),)
host := $(shell $(src_root)/config.guess)
@@ -140,8 +154,8 @@ libbutl_obj := $(patsubst $(libbutl)/libbutl/%.cxx,$(libbutl_out)/%.b.o,$(libbut
# Build.
#
-$(out_root)/build2/b-boot: $(build2_obj) $(libbutl_obj)
- $(CXX) -std=c++1y $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -lpthread $(LIBS)
+$(out_root)/build2/b-boot$(exe): $(build2_obj) $(libbutl_obj)
+ $(CXX) -std=c++1y $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(out_root)/build2/%.b.o: $(src_root)/build2/%.cxx | $$(dir $$@).
$(CXX) -I$(libbutl) -I$(src_root) -DBUILD2_BOOTSTRAP -DBUILD2_HOST_TRIPLET=\"$(chost)\" $(CPPFLAGS) -std=c++1y $(CXXFLAGS) -o $@ -c $<
@@ -154,7 +168,7 @@ $(libbutl_out)/%.b.o: $(libbutl)/libbutl/%.cxx | $$(dir $$@).
mkdir -p $*
.PHONY: all
-all: $(out_root)/build2/b-boot
+all: $(out_root)/build2/b-boot$(exe)
# Clean.
#
@@ -165,7 +179,7 @@ cleano:
rm -f $(libbutl_obj)
clean: cleano
- rm -f $(out_root)/build2/b-boot
+ rm -f $(out_root)/build2/b-boot$(exe)
ifeq ($(in_tree),false)
rm -fd $(foreach d,$(sub_dirs),$(out_root)/build2/$d) $(out_root)/build2 $(libbutl_out)
endif