Permalink
Browse files

Integrate NetBSD/evbarm Raspberry Pi cross-build.

  • Loading branch information...
1 parent 3fb5ffe commit 5193bfe7d0e2409f7f88110c531af0025efd04c4 @schmonz committed Feb 12, 2017
Showing with 17 additions and 14 deletions.
  1. +17 −5 GNUmakefile
  2. +0 −9 GNUmakefile.rpi
View
@@ -1,22 +1,34 @@
SILENT ?= @
+DEFAULT_SYSTEM = host
THE_TESTS = check_roman_calculator
THE_LIBRARY = roman_calculator.a
THE_PROGRAM = romancalc
+TARGET_SYSTEM ?= ${DEFAULT_SYSTEM}
+ifeq (rpi, ${TARGET_SYSTEM})
+MAKE_TARGET = ${THE_PROGRAM}
+TOOLDIR ?= ${HOME}/rpi/tools
+TARGET_PREFIX = armv6--netbsdelf-eabihf-
+CFLAGS += --sysroot=${HOME}/rpi/distrib/evbearmv6hf-el
+else
+MAKE_TARGET = check
TOOLDIR ?= /usr
+TARGET_PREFIX ?=
+endif
-CC ?= ${TOOLDIR}/bin/gcc
-LD ?= ${TOOLDIR}/bin/ld
-AR ?= ${TOOLDIR}/bin/ar
-RANLIB ?= ${TOOLDIR}/bin/ranlib
+CC = ${TOOLDIR}/bin/${TARGET_PREFIX}gcc
+LD = ${TOOLDIR}/bin/${TARGET_PREFIX}ld
+AR = ${TOOLDIR}/bin/${TARGET_PREFIX}ar
+RANLIB = ${TOOLDIR}/bin/${TARGET_PREFIX}ranlib
CFLAGS += -g -O0 -Wall -Werror -Wextra -std=c99
TEST_CFLAGS := $(shell pkg-config --cflags check)
TEST_LIBS := $(shell pkg-config --libs check)
TEST_LIBS += -lm
-all: check
+all:
+ ${SILENT}${MAKE} ${MAKE_TARGET}
check: ${THE_TESTS}
${SILENT}./${THE_TESTS}
View
@@ -1,9 +0,0 @@
-TOOLDIR = /Users/schmonz/rpi/tools
-
-CC = ${TOOLDIR}/bin/armv6--netbsdelf-eabihf-gcc
-LD = ${TOOLDIR}/bin/armv6--netbsdelf-eabihf-ld
-AR = ${TOOLDIR}/bin/armv6--netbsdelf-eabihf-ar
-RANLIB = ${TOOLDIR}/bin/armv6--netbsdelf-eabihf-ranlib
-CFLAGS += --sysroot=/Users/schmonz/rpi/distrib/evbearmv6hf-el
-
-include GNUmakefile

0 comments on commit 5193bfe

Please sign in to comment.