From ff9b371363f809298ca3ce8a886943b246b1dfa2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Christian=20Gr=C3=BCnhage?=
 <jan.christian@gruenhage.xyz>
Date: Thu, 7 Oct 2021 18:06:54 +0200
Subject: [PATCH 3/3] start work on cross compilation

The tests have to be run on the host, so these shouldn't be cross
compiled. This patch is not done yet, but it's included here anyway, so
that whoever wants to continue on it doesn't have to start from scratch.
---
 makeflags     | 3 +++
 test/Makefile | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/makeflags b/makeflags
index e008011..da4f5f7 100644
--- a/makeflags
+++ b/makeflags
@@ -11,3 +11,6 @@ CCFLAGS += -I../include -D_FILE_OFFSET_BITS=64
 
 BEES_CFLAGS   = $(CCFLAGS) -std=c99 $(CFLAGS)
 BEES_CXXFLAGS = $(CCFLAGS) -std=c++11 -Wold-style-cast -Wno-missing-field-initializers $(CXXFLAGS)
+
+BEES_CFLAGS_FOR_BUILD   = $(CCFLAGS_FOR_BUILD) -std=c99 $(CFLAGS_FOR_BUILD)
+BEES_CXXFLAGS_FOR_BUILD = $(CCFLAGS_FOR_BUILD) -std=c++11 -Wold-style-cast $(CXXFLAGS_FOR_BUILD)
diff --git a/test/Makefile b/test/Makefile
index ae66a7c..3c70244 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -24,7 +24,7 @@ BEES_LDFLAGS = -L../lib $(LDFLAGS)
 	mkdir -p $@
 
 .depends/%.dep: %.cc tests.h Makefile | .depends
-	$(CXX) $(BEES_CXXFLAGS) -M -MF $@ -MT $(<:.cc=.o) $<
+	$(CXX_FOR_BUILD) $(BEES_CXXFLAGS_FOR_BUILD) -M -MF $@ -MT $(<:.cc=.o) $<
 
 depends.mk: $(PROGRAMS:%=.depends/%.dep)
 	cat $^ > $@.new
@@ -33,10 +33,10 @@ depends.mk: $(PROGRAMS:%=.depends/%.dep)
 include depends.mk
 
 $(PROGRAMS:%=%.o): %.o: %.cc ../makeflags Makefile
-	$(CXX) $(BEES_CXXFLAGS) -o $@ -c $<
+	$(CXX_FOR_BUILD) $(BEES_CXXFLAG_FOR_BUILDS) -o $@ -c $<
 
 $(PROGRAMS): %: %.o ../makeflags Makefile ../lib/libcrucible.a
-	$(CXX) $(BEES_CXXFLAGS) $(BEES_LDFLAGS) -o $@ $< $(LIBS)
+	$(CXX_FOR_BUILD) $(BEES_CXXFLAGS_FOR_BUILD) $(BEES_LDFLAGS) -o $@ $< $(LIBS)
 
 %.txt: % Makefile FORCE
 	./$< >$@ 2>&1 || (RC=$$?; cat $@; exit $$RC)
-- 
2.38.1

