diff mbox

support autoconf

Message ID 1403354099-11031-1-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov June 21, 2014, 12:34 p.m. UTC
Implement ./configure using original odp Makefiles

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---

 This is propose of patch to implement autoconf/automake for odp.
 If we already have all makefiles that might be no reason to use m4.
 And keep using configure.in and Makefile.in.

 Compilation now is standard procedure with autotools:
 autoreconf
 ./configure
 for KS2 ./configure --with-platform=linux-keystone2

 Best regards,
 Maxim.


 Makefile => Makefile.in                            |  0
 Makefile.inc                                       |  6 +--
 Makefileinc.in                                     | 62 ++++++++++++++++++++++
 configure.in                                       | 60 +++++++++++++++++++++
 platform/linux-generic/{Makefile => Makefile.in}   | 10 +---
 platform/linux-keystone2/{Makefile => Makefile.in} |  6 +--
 6 files changed, 127 insertions(+), 17 deletions(-)
 rename Makefile => Makefile.in (100%)
 create mode 100644 Makefileinc.in
 create mode 100644 configure.in
 rename platform/linux-generic/{Makefile => Makefile.in} (94%)
 rename platform/linux-keystone2/{Makefile => Makefile.in} (95%)
diff mbox

Patch

diff --git a/Makefile b/Makefile.in
similarity index 100%
rename from Makefile
rename to Makefile.in
diff --git a/Makefile.inc b/Makefile.inc
index ff16043..dfa92ed 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -19,7 +19,7 @@  RM     := rm -f
 COPY   := cp -r
 SYNC   := rsync -a --delete
 
-ifneq ($(VERBOSE),yes)
+ifneq (no,yes)
 Q          = @
 MAKEFLAGS += --no-print-directory
 endif
@@ -29,13 +29,13 @@  QUIET_LD   = $(Q:@=@echo    '     LD       '$@;)
 QUIET_AR   = $(Q:@=@echo    '     AR       '$@;)
 export Q QUIET_CC QUIET_LD QUIET_AR
 
-ifeq ($(ODP_DEBUG_PRINT),no)
+ifeq (yes,no)
 EXTRA_CFLAGS += -DODP_DEBUG_PRINT=0
 else
 EXTRA_CFLAGS += -DODP_DEBUG_PRINT=1
 endif
 
-ifeq ($(DEBUG),yes)
+ifeq (no,yes)
 EXTRA_CFLAGS += -O0 -g
 else
 EXTRA_CFLAGS += -O3
diff --git a/Makefileinc.in b/Makefileinc.in
new file mode 100644
index 0000000..5076384
--- /dev/null
+++ b/Makefileinc.in
@@ -0,0 +1,62 @@ 
+# Copyright (c) 2013, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier:	BSD-3-Clause
+
+PLATFORM ?= @PLATFORM@
+OBJ_DIR   = ./obj
+ODP_DIR   = $(ODP_ROOT)/platform/$(PLATFORM)
+
+export DESTDIR  = $(ODP_ROOT)/build
+
+CC     ?= gcc
+LD     ?= gcc
+AR     ?= ar
+ECHO   := @echo
+MKDIR  := mkdir -p
+RMDIR  := rm -rf
+RM     := rm -f
+COPY   := cp -r
+SYNC   := rsync -a --delete
+
+ifneq (@VERBOSE@,yes)
+Q          = @
+MAKEFLAGS += --no-print-directory
+endif
+
+QUIET_CC   = $(Q:@=@echo    '     CC       '$@;)
+QUIET_LD   = $(Q:@=@echo    '     LD       '$@;)
+QUIET_AR   = $(Q:@=@echo    '     AR       '$@;)
+export Q QUIET_CC QUIET_LD QUIET_AR
+
+ifeq (@ODP_DEBUG_PRINT@,no)
+EXTRA_CFLAGS += -DODP_DEBUG_PRINT=0
+else
+EXTRA_CFLAGS += -DODP_DEBUG_PRINT=1
+endif
+
+ifeq (@DEBUG@,yes)
+EXTRA_CFLAGS += -O0 -g
+else
+EXTRA_CFLAGS += -O3
+endif
+
+EXTRA_CFLAGS += -pthread
+EXTRA_CFLAGS += -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
+EXTRA_CFLAGS += -Wmissing-declarations -Wold-style-definition -Wpointer-arith
+EXTRA_CFLAGS += -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral
+EXTRA_CFLAGS += -Wformat-security -Wundef -Wwrite-strings
+
+
+LDFLAGS += -pthread
+LDFLAGS += $(CFLAGS)
+
+STD_LIBS += -lrt
+
+include $(wildcard $(ODP_DIR)/Makefile.inc)
+
+.PHONY: default
+default:
+
+$(OBJ_DIR):
+	$(Q)$(MKDIR) $(OBJ_DIR)
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..fcfefc9
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,60 @@ 
+AC_INIT([odp], 0.2)
+
+AC_MSG_CHECKING([checking for platform])
+AC_ARG_WITH([platform],
+[  --with-platform=PLAT    linux-generic (default)
+ 			  linux-keystone2 ],
+[if test x"$withval" != x ; then
+	PLATFORM="$withval"
+fi],
+[PLATFORM="linux-generic"])
+AC_MSG_RESULT($PLATFORM)
+AC_SUBST(PLATFORM)
+
+ODP_HAVE_NETMAP=""
+AC_ARG_ENABLE([reloc],
+	      AS_HELP_STRING([--enable-netmap], [compile netmap support (linux-generic only)]))
+AS_IF([test "x$enable_netmap" = "xyes"], [
+       ODP_HAVE_NETMAP="-DODP_HAVE_NETMAP"
+       ])
+AC_SUBST(ODP_HAVE_NETMAP)
+
+ODP_RELOC=""
+AC_ARG_ENABLE([reloc],
+    AS_HELP_STRING([--enable-reloc], [compile library with position independent code]))
+AS_IF([test "x$enable_reloc" = "xyes"], [
+  ODP_RELOC="-fpic"
+])
+AC_SUBST(ODP_RELOC)
+
+ODP_DEBUG_PRINT="yes"
+AC_ARG_ENABLE([debug_print],
+    AS_HELP_STRING([--disable-debug_print], [disable odp debug print]))
+AS_IF([test "x$enable_debug" = "xyes"], [
+ ODP_DEBUG_PRINT="no"
+])
+AC_SUBST(ODP_DEBUG_PRINT)
+
+DEBUG="no"
+AC_ARG_ENABLE([debug],
+    AS_HELP_STRING([--enable-debug], [compile code with debug info]))
+AS_IF([test "x$enable_debug" = "xyes"], [
+  DEBUG="yes"
+])
+AC_SUBST(DEBUG)
+
+VERBOSE="no"
+AC_ARG_ENABLE([debug],
+    AS_HELP_STRING([--enable-verbose], [enable compilation verbose]))
+AS_IF([test "x$enable_debug" = "xyes"], [
+  VERBOSE="yes"
+])
+AC_SUBST(VERBOSE)
+
+AC_CONFIG_FILES(platform/linux-generic/Makefile)
+AC_CONFIG_FILES(platform/linux-keystone2/Makefile)
+AC_CONFIG_FILES(Makefile.inc:Makefileinc.in)
+AC_CONFIG_FILES(Makefile)
+
+AC_PROG_CC
+AC_OUTPUT
diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile.in
similarity index 94%
rename from platform/linux-generic/Makefile
rename to platform/linux-generic/Makefile.in
index 0737656..bb9b862 100644
--- a/platform/linux-generic/Makefile
+++ b/platform/linux-generic/Makefile.in
@@ -36,15 +36,7 @@  EXTRA_CFLAGS  += -I$(ODP_ROOT)/include
 EXTRA_CFLAGS  += -I./include
 EXTRA_CFLAGS  += -I./include/api
 
-# Option for shared libraries.
-# Decreases performance with static libraries.
-ifeq ($(ODP_RELOC),yes)
-EXTRA_CFLAGS  += -fpic
-endif
-
-ifeq ($(ODP_HAVE_NETMAP),yes)
-EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
-endif
+EXTRA_CFLAGS  += @ODP_RELOC@ @ODP_HAVE_NETMAP@
 
 include $(ODP_ROOT)/Makefile.inc
 STATIC_LIB = ./lib/libodp.a
diff --git a/platform/linux-keystone2/Makefile b/platform/linux-keystone2/Makefile.in
similarity index 95%
rename from platform/linux-keystone2/Makefile
rename to platform/linux-keystone2/Makefile.in
index a0e2922..91e8162 100644
--- a/platform/linux-keystone2/Makefile
+++ b/platform/linux-keystone2/Makefile.in
@@ -13,11 +13,7 @@  DOC_DIR  = ./doc
 
 LINUX_GENERIC_DIR = ../linux-generic
 
-# Option for shared libraries.
-# Decreases performance with static libraries.
-ifeq ($(ODP_RELOC),yes)
-EXTRA_CFLAGS  += -fpic
-endif
+EXTRA_CFLAGS  += @ODP_RELOC@
 
 MY_PLATFORM  = DEVICE_K2K