diff --git a/config.arm-linux-gnu.mk b/config.arm-linux-gnu.mk new file mode 100644 index 0000000..4a64daa --- /dev/null +++ b/config.arm-linux-gnu.mk @@ -0,0 +1,23 @@ +#****************************************************************************** +# config.arm-linux-gnu.mk Build project +#****************************************************************************** +# +# File Description: +# +# Compilation profile for arm-linux-gnu +# +# +# +# +# +# +# +# +#****************************************************************************** +# (C) 2017 Christophe de Dinechin +#This software is licensed under the GNU General Public License v3 +#See file COPYING for details. +#****************************************************************************** + +CROSS_COMPILE=arm-linux-gnu +include $(BUILD)config.gnu.mk diff --git a/config.gnu.mk b/config.gnu.mk index 96a5007..ec1cacd 100644 --- a/config.gnu.mk +++ b/config.gnu.mk @@ -22,13 +22,13 @@ # Tools #------------------------------------------------------------------------------ -CC= gcc -CXX= g++ +CC= $(CROSS_COMPILE:%=%-)gcc +CXX= $(CROSS_COMPILE:%=%-)g++ LD= $(CXX) CPP= $(CC) -E PYTHON= python -AR= ar -rcs -RANLIB= ranlib +AR= $(CROSS_COMPILE:%=%-)ar -rcs +RANLIB= $(CROSS_COMPILE:%=%-)ranlib LIBTOOL= libtool -no_warning_for_no_symbols INSTALL= install diff --git a/hello.cpp b/hello.cpp index bb3c2d9..65657c8 100644 --- a/hello.cpp +++ b/hello.cpp @@ -1,5 +1,9 @@ #include "config.h" +#if HAVE_IOSTREAM #include +#elif HAVE_STDIO_H +#include +#endif // IO #if HAVE_SYS_IMPROBABLE_H #warning "Improbable header present, probably a fault in the build system" @@ -11,5 +15,11 @@ int main() { +#if HAVE_IOSTREAM std::cout << "You successfully built using build\n"; +#elif HAVE_STDIO_H + printf("You successfully built using build (without iostream)\n"); +#else +#warning "Building without or . Cross-compiling?" +#endif // HAVE_IOSTREAM } diff --git a/rules.mk b/rules.mk index 6babe5e..08ac2c2 100644 --- a/rules.mk +++ b/rules.mk @@ -45,8 +45,8 @@ DIR:= $(subst $(BASEDIR),,$(FULLDIR)) PRETTY_DIR:= $(subst $(BASEDIR),[top],$(FULLDIR)) BASENAME_DIR:= $(shell basename $(FULLDIR)) BUILD_DATE:= $(shell /bin/date '+%Y%m%d-%H%M%S') -OBJROOT:= $(BUILDOBJ)/$(BUILDENV)/$(TARGET)$(BASE_EXTRA_DEPTH) -BUILD_LOG:= $(BUILD_LOGS)build-$(BUILDENV)-$(TARGET)-$(BUILD_DATE).log +OBJROOT:= $(BUILDOBJ)/$(BUILDENV)/$(CROSS_COMPILE:%=%-)$(TARGET)$(BASE_EXTRA_DEPTH) +BUILD_LOG:= $(BUILD_LOGS)build-$(BUILDENV)-$(CROSS_COMPILE:%=%-)$(TARGET)-$(BUILD_DATE).log endif # Configuration variables