From f8eb76eea9ec9cd8f799ab9b44251c7f3b945206 Mon Sep 17 00:00:00 2001
From: Daniel Friesel <daniel.friesel@uos.de>
Date: Wed, 29 Apr 2020 12:48:58 +0200
Subject: Makefile: Create build directory if needed

---
 src/arch/arduino-nano-168/Makefile.inc | 1 +
 src/arch/arduino-nano/Makefile.inc     | 1 +
 src/arch/blinkenrocket/Makefile.inc    | 1 +
 src/arch/esp8266/Makefile.inc          | 1 +
 src/arch/msp430fr5969lp/Makefile.inc   | 1 +
 src/arch/msp430fr5994lp/Makefile.inc   | 1 +
 src/arch/posix/Makefile.inc            | 1 +
 7 files changed, 7 insertions(+)

(limited to 'src')

diff --git a/src/arch/arduino-nano-168/Makefile.inc b/src/arch/arduino-nano-168/Makefile.inc
index 70392e1..844fc1d 100644
--- a/src/arch/arduino-nano-168/Makefile.inc
+++ b/src/arch/arduino-nano-168/Makefile.inc
@@ -94,6 +94,7 @@ OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}
 	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}
 
 build/system.elf: ${OBJECTS}
+	${QUIET}mkdir -p build
 	${QUIET}${CXX} ${COMMON_FLAGS} ${CXXFLAGS} -Wl,--gc-sections -o $@ ${OBJECTS}
 	${QUIET}avr-size --format=avr --mcu=${MCU} $@
 	${QUIET}test $$(avr-size --format=avr --mcu=${MCU} build/system.elf | fgrep Program | grep -o '[0-9.]*%' | cut -d . -f 1) -lt 100
diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc
index a664a30..5445bc1 100644
--- a/src/arch/arduino-nano/Makefile.inc
+++ b/src/arch/arduino-nano/Makefile.inc
@@ -94,6 +94,7 @@ OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}
 	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}
 
 build/system.elf: ${OBJECTS}
+	${QUIET}mkdir -p build
 	${QUIET}${CXX} ${COMMON_FLAGS} ${CXXFLAGS} -Wl,--gc-sections -o $@ ${OBJECTS}
 	${QUIET}avr-size --format=avr --mcu=${MCU} $@
 	${QUIET}test $$(avr-size --format=avr --mcu=${MCU} build/system.elf | fgrep Program | grep -o '[0-9.]*%' | cut -d . -f 1) -lt 100
diff --git a/src/arch/blinkenrocket/Makefile.inc b/src/arch/blinkenrocket/Makefile.inc
index 0cfb2e0..ea4e183 100644
--- a/src/arch/blinkenrocket/Makefile.inc
+++ b/src/arch/blinkenrocket/Makefile.inc
@@ -38,6 +38,7 @@ OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o}
 	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}
 
 build/system.elf: ${OBJECTS}
+	${QUIET}mkdir -p build
 	${CXX} ${COMMON_FLAGS} ${CXXFLAGS} -Wl,--gc-sections -o $@ ${OBJECTS}
 	avr-size --format=avr --mcu=${MCU} $@
 
diff --git a/src/arch/esp8266/Makefile.inc b/src/arch/esp8266/Makefile.inc
index f0f36f9..c1bb621 100644
--- a/src/arch/esp8266/Makefile.inc
+++ b/src/arch/esp8266/Makefile.inc
@@ -47,6 +47,7 @@ endif
 	${QUIET}${OBJCOPY} --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal $@
 
 build/system.ar: ${OBJECTS}
+	${QUIET}mkdir -p build
 	${AR} cru $@ ${OBJECTS}
 
 build/system.elf: build/system.ar
diff --git a/src/arch/msp430fr5969lp/Makefile.inc b/src/arch/msp430fr5969lp/Makefile.inc
index eb275da..1aa77f2 100644
--- a/src/arch/msp430fr5969lp/Makefile.inc
+++ b/src/arch/msp430fr5969lp/Makefile.inc
@@ -83,6 +83,7 @@ OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o} ${ASM_TARGETS:.S=.o}
 	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} -Wa,-gstabs,-ggdb -x assembler-with-cpp -c -o $@ ${@:.o=.S}
 
 build/system.elf: ${OBJECTS}
+	${QUIET}mkdir -p build
 	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} \
 		-Wl,--library-path=/opt/msp430/ti/gcc/include/ \
 		-Wl,--gc-sections \
diff --git a/src/arch/msp430fr5994lp/Makefile.inc b/src/arch/msp430fr5994lp/Makefile.inc
index 9c48633..8348d8e 100644
--- a/src/arch/msp430fr5994lp/Makefile.inc
+++ b/src/arch/msp430fr5994lp/Makefile.inc
@@ -91,6 +91,7 @@ OBJECTS = ${CXX_TARGETS:.cc=.o} ${C_TARGETS:.c=.o} ${ASM_TARGETS:.S=.o}
 	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} -Wa,-gstabs,-ggdb -x assembler-with-cpp -c -o $@ ${@:.o=.S}
 
 build/system.elf: ${OBJECTS}
+	${QUIET}mkdir -p build
 	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} \
 		-Wl,--library-path=/opt/msp430/ti/msp430-gcc-full-linux-5.1.2.0/include/ \
 		-Wl,--gc-sections \
diff --git a/src/arch/posix/Makefile.inc b/src/arch/posix/Makefile.inc
index 7433bb5..7bf4ba0 100644
--- a/src/arch/posix/Makefile.inc
+++ b/src/arch/posix/Makefile.inc
@@ -32,6 +32,7 @@ endif
 	${QUIET}${CC} ${INCLUDES} ${COMMON_FLAGS} ${CFLAGS} -c -o $@ ${@:.o=.c}
 
 build/system.elf: ${OBJECTS}
+	${QUIET}mkdir -p build
 	${QUIET}${CXX} ${INCLUDES} ${COMMON_FLAGS} ${CXXFLAGS} \
 		-o $@ ${OBJECTS}
 
-- 
cgit v1.2.3