make: fix compiler flags probing
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 5 Mar 2016 11:22:16 +0000 (12:22 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 5 Mar 2016 14:30:36 +0000 (15:30 +0100)
Basically reverts
  "make: need to load the OS specific makefile before evaluating WARNINGS"
  d9b773d94c5f84a769a20a563f9cf25a81a030fa.
and then adds OS specific compiler support

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Makefile.inc
make/Makefile.android
make/Makefile.android.compiler [new file with mode: 0644]

index d4196d6..379183e 100644 (file)
@@ -87,13 +87,8 @@ ifneq ($(TOPDIR),.)
 CPPFLAGS +=    -I$(TOPDIR)/src
 endif
 
-ifeq ($(OS),UNKNOWN)
-all: help
-else
-# include OS specifics
-all: default_target
-include $(TOPDIR)/make/Makefile.$(OS)
-endif
+# include OS specific compiler settings
+-include $(TOPDIR)/make/Makefile.$(OS).compiler
 
 # add gcc warnings and optimizations if CFLAGS not set
 ifndef CFLAGS
@@ -260,6 +255,14 @@ CPPFLAGS +=     -DUSE_FPM
 SRCS +=                $(wildcard src/common/*.c src/*.c *.c)
 HDRS +=                $(wildcard src/common/*.h src/*.h *.h)
 
+ifeq ($(OS),UNKNOWN)
+all: help
+else
+# include OS specifics
+all: default_target
+include $(TOPDIR)/make/Makefile.$(OS)
+endif
+
 # one object for each source file
 OBJS +=                $(SRCS:%.c=%.o)
 
index 6bc1a6a..1bfe47e 100644 (file)
@@ -92,26 +92,9 @@ INSTALL_LIB =        install -D -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME);
 UNINSTALL_LIB =        rm -f $(LIBDIR)/$(PLUGIN_FULLNAME); \
                /sbin/ldconfig -n $(LIBDIR)
 
-# Android NDK setup
-NDK_BASE ?= /opt/android-ndk
-NDK_PLATFORM_LEVEL ?= 4
-NDK_ARCH=$(shell uname -m)
-ifneq ($(NDK_ARCH),x86_64)
-NDK_ARCH=x86
-endif
-NDK_ABI=arm
-NDK_ABIDIR=linux-androideabi
-NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)
-NDK_UNAME=$(shell uname -s | tr '[A-Z]' '[a-z]')
-# if you are using NDK older than r10, you must use 4.4.3:
-#NDK_COMPILER_VERSION=4.4.3
-NDK_COMPILER_VERSION=4.8
-NDK_TOOLCHAIN=$(NDK_BASE)/toolchains/$(NDK_ABI)-$(NDK_ABIDIR)-$(NDK_COMPILER_VERSION)/prebuilt/$(NDK_UNAME)-$(NDK_ARCH)
-CROSS_COMPILE = $(NDK_TOOLCHAIN)/bin/$(NDK_ABI)-$(NDK_ABIDIR)-
+# include compiler settings
+include $(TOPDIR)/make/Makefile.android.compiler
 
-CC = $(CROSS_COMPILE)gcc --sysroot="$(NDK_SYSROOT)"
-LD = $(CROSS_COMPILE)ld
-AR = $(CROSS_COMPILE)ar
 ifeq ($(DEBUG),0)
 STRIP = $(CROSS_COMPILE)strip
 endif
diff --git a/make/Makefile.android.compiler b/make/Makefile.android.compiler
new file mode 100644 (file)
index 0000000..e018de3
--- /dev/null
@@ -0,0 +1,21 @@
+# Android NDK setup
+NDK_BASE ?= /opt/android-ndk
+NDK_PLATFORM_LEVEL ?= 4
+NDK_ARCH=$(shell uname -m)
+ifneq ($(NDK_ARCH),x86_64)
+NDK_ARCH=x86
+endif
+
+NDK_ABI=arm
+NDK_ABIDIR=linux-androideabi
+NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_LEVEL)/arch-$(NDK_ABI)
+NDK_UNAME=$(shell uname -s | tr '[A-Z]' '[a-z]')
+# if you are using NDK older than r10, you must use 4.4.3:
+#NDK_COMPILER_VERSION=4.4.3
+NDK_COMPILER_VERSION=4.8
+NDK_TOOLCHAIN=$(NDK_BASE)/toolchains/$(NDK_ABI)-$(NDK_ABIDIR)-$(NDK_COMPILER_VERSION)/prebuilt/$(NDK_UNAME)-$(NDK_ARCH)
+CROSS_COMPILE = $(NDK_TOOLCHAIN)/bin/$(NDK_ABI)-$(NDK_ABIDIR)-
+
+CC = $(CROSS_COMPILE)gcc --sysroot="$(NDK_SYSROOT)"
+LD = $(CROSS_COMPILE)ld
+AR = $(CROSS_COMPILE)ar
\ No newline at end of file