From f44525c29ff236a69d968c87353a54f98592be44 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 8 Jul 2019 21:52:56 +0000 Subject: [PATCH] Common ONLP shared library and static binary build makefiles. --- .../base/any/onlp/builds/platform/build.mk | 2 + .../base/any/onlp/builds/platform/common.mk | 32 ++++++++++++++ .../onlp/builds/platform/libonlp-platform.mk | 41 ++++++++++++++++++ .../base/any/onlp/builds/platform/onlps.mk | 43 +++++++++++++++++++ 4 files changed, 118 insertions(+) create mode 100644 packages/base/any/onlp/builds/platform/build.mk create mode 100644 packages/base/any/onlp/builds/platform/common.mk create mode 100644 packages/base/any/onlp/builds/platform/libonlp-platform.mk create mode 100644 packages/base/any/onlp/builds/platform/onlps.mk diff --git a/packages/base/any/onlp/builds/platform/build.mk b/packages/base/any/onlp/builds/platform/build.mk new file mode 100644 index 00000000..a008a0b2 --- /dev/null +++ b/packages/base/any/onlp/builds/platform/build.mk @@ -0,0 +1,2 @@ +DIRECTORIES := lib onlps +include $(ONL)/make/subdirs.mk diff --git a/packages/base/any/onlp/builds/platform/common.mk b/packages/base/any/onlp/builds/platform/common.mk new file mode 100644 index 00000000..49c24b67 --- /dev/null +++ b/packages/base/any/onlp/builds/platform/common.mk @@ -0,0 +1,32 @@ +ifndef PLATFORM +$(error $$PLATFORM not set) +endif + +ifndef ARCH + # Determine ARCH from platform name + ifeq ($(findstring x86-64-,$(PLATFORM)),x86-64-) + ARCH := amd64 + endif + + ifeq ($(findstring powerpc-,$(PLATFORM)),powerpc-) + ARCH := powerpc + endif + + ifeq ($(findstring arm-,$(PLATFORM)),arm-) + ARCH := armel + endif + + ifeq ($(findstring arm64-,$(PLATFORM)),arm64-) + ARCH := arm64 + endif +endif + +ifndef ARCH +$(error $$ARCH not set and the architecture cannot be determined from the given platform name ($(PLATFORM))) +endif + +ifndef PLATFORM_MODULE +PLATFORM_MODULE := $(subst -,_,$(PLATFORM)) +endif + +include $(ONL)/make/config.$(ARCH).mk diff --git a/packages/base/any/onlp/builds/platform/libonlp-platform.mk b/packages/base/any/onlp/builds/platform/libonlp-platform.mk new file mode 100644 index 00000000..0fe0c277 --- /dev/null +++ b/packages/base/any/onlp/builds/platform/libonlp-platform.mk @@ -0,0 +1,41 @@ +############################################################ +# +# +# Copyright 2014-2018 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +include $(ONL)/packages/base/any/onlp/builds/platform/common.mk + +MODULE := libonlp-$(PLATFORM) +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM IOF onlplib $(DEPENDMODULES) $(PLATFORM_MODULE) $(EXTRA_MODULES) +DEPENDMODULE_HEADERS := $(DEPENDMODULE_HEADERS) sff + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := libonlp-$(PLATFORM).so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk +.DEFAULT_GOAL := $(SHAREDLIB) + +GLOBAL_CFLAGS += -I$(onlp_BASEDIR)/module/inc +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread + +include $(BUILDER)/targets.mk diff --git a/packages/base/any/onlp/builds/platform/onlps.mk b/packages/base/any/onlp/builds/platform/onlps.mk new file mode 100644 index 00000000..a1496df6 --- /dev/null +++ b/packages/base/any/onlp/builds/platform/onlps.mk @@ -0,0 +1,43 @@ +############################################################ +# +# +# Copyright 2014-2018 BigSwitch Networks, Inc. +# +# Licensed under the Eclipse Public License, Version 1.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.eclipse.org/legal/epl-v10.html +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +# either express or implied. See the License for the specific +# language governing permissions and limitations under the +# License. +# +# +############################################################ +include $(ONL)/packages/base/any/onlp/builds/platform/common.mk + +.DEFAULT_GOAL := onlps + +MODULE := onlps +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := $(DEPENDMODULES) AIM IOF onlp onlplib $(PLATFORM_MODULE) onlp_platform_defaults sff cjson cjson_util timer_wheel OS uCli ELS $(EXTRA_MODULES) + +include $(BUILDER)/dependmodules.mk + +BINARY := onlps +$(BINARY)_LIBRARIES := $(LIBRARY_TARGETS) +include $(BUILDER)/bin.mk + +GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_CFLAGS += -DUCLI_CONFIG_INCLUDE_ELS_LOOP=1 +GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_UCLI=1 +GLOBAL_LINK_LIBS += -lpthread -lm -ledit + +include $(BUILDER)/targets.mk