Makefiles for compiling O1 code.[Issue-Id: ODUHIGH-224] 18/4818/7
authorVidhu <vidhu.pandey@hcl.com>
Wed, 7 Oct 2020 13:41:57 +0000 (19:11 +0530)
committerVidhu <vidhu.pandey@hcl.com>
Wed, 11 Nov 2020 15:14:53 +0000 (20:44 +0530)
Signed-off-by: Vidhu <vidhu.pandey@hcl.com>
Change-Id: I4fc6b88a6a0c63c461fff7deec39ea043aaed568

build/common/o1.mak [new file with mode: 0755]
build/common/o1_client.mak [new file with mode: 0644]
build/o1/makefile [new file with mode: 0644]
build/odu/makefile

diff --git a/build/common/o1.mak b/build/common/o1.mak
new file mode 100755 (executable)
index 0000000..639d75b
--- /dev/null
@@ -0,0 +1,55 @@
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+# This is makefile for O1 module
+
+include ../common/rsys_fancy.mak
+include ../common/env.mak
+COLOR=$(COLOR_RED)
+
+ROOT_DIR=$(patsubst %/build/o1,%,$(BUILD_DIR))
+
+SRC_DIR=$(ROOT_DIR)/src/o1/
+CPP_SRCS=$(wildcard $(SRC_DIR)/*.cpp)
+CPP_OBJS=$(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(CPP_SRCS))
+
+lib: $(LIB_DIR)/libo1.a
+include $(COM_BUILD_DIR)/compile.mak
+
+L_OPTS=-lsysrepo -lyang
+L_OPTS+= -lsysrepo-cpp -lyang-cpp
+L_OPTS+= -lm -lpthread
+I_OPTS=-I$(ROOT_DIR)/src/o1/
+I_OPTS+=-I$(ROOT_DIR)/src/o1/o1_client
+
+#-------------------------------------------------------------#
+#Linker macros
+#-------------------------------------------------------------#
+
+$(LIB_DIR)/libo1.a:$(CPP_OBJS)
+                 @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)"
+                 $(Q)ar -cr $(LIB_DIR)/libo1.a $(CPP_OBJS)
+
+#-------------------------------------------------------------#
+#Clean macros
+#-------------------------------------------------------------#
+clean:
+                 @echo -e "$(COLOR_RED)Cleaning O1$(REVERT_COLOR)"
+                 $(Q)\rm -f $(LIB_DIR)/libo1.a $(CPP_OBJS) 
+
+#######################################################################
+#         End of file                                                 #
+#######################################################################
diff --git a/build/common/o1_client.mak b/build/common/o1_client.mak
new file mode 100644 (file)
index 0000000..60948c0
--- /dev/null
@@ -0,0 +1,53 @@
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+# This is makefile for O1 client
+
+include ../common/rsys_fancy.mak
+include ../common/env.mak
+COLOR=$(COLOR_RED)
+
+SRC_DIR=$(ROOT_DIR)/src/o1/o1_client
+C_SRCS=$(wildcard $(SRC_DIR)/*.c)
+C_OBJS=$(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(C_SRCS))
+
+lib: $(LIB_DIR)/libo1client.a
+include $(COM_BUILD_DIR)/compile.mak
+
+L_OPTS=-lsysrepo -lyang
+L_OPTS+= -lsysrepo-cpp -lyang-cpp
+L_OPTS+= -lm -lpthread
+I_OPTS+=-I$(ROOT_DIR)/src/o1/o1_client
+I_OPTS+=-I$(ROOT_DIR)/src/cm
+I_OPTS+=-I$(ROOT_DIR)/src/mt
+
+#-------------------------------------------------------------#
+#Linker macros
+#-------------------------------------------------------------#
+$(LIB_DIR)/libo1client.a:$(C_OBJS) $(C_WO_PED_OBJS)
+                 @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)"
+                 $(Q)ar -cr $(LIB_DIR)/libo1client.a $(C_OBJS) $(C_WO_PED_OBJS)
+
+#-------------------------------------------------------------#
+#Clean macros
+#-------------------------------------------------------------#
+clean:
+                 @echo -e "$(COLOR_RED)Cleaning O1 Client$(REVERT_COLOR)"
+                 $(Q)\rm -f $(LIB_DIR)/libo1client.a $(C_OBJS) $(C_WO_PED_OBJS) $(LOG_FILES) $(BAK_FILES)
+#######################################################################
+#         End of file                                                 #
+#######################################################################
diff --git a/build/o1/makefile b/build/o1/makefile
new file mode 100644 (file)
index 0000000..4eac400
--- /dev/null
@@ -0,0 +1,126 @@
+################################################################################
+#   Copyright (c) [2017-2019] [Radisys]                                        #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   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.                                             #
+################################################################################
+
+# Master makefile for O1 module
+
+# Identify the location our software which is used by rest
+# of the build scripts
+
+include ../common/rsys_fancy.mak
+include ../common/env.mak
+
+ROOT_DIR=$(patsubst %/build/o1,%,$(BUILD_DIR))
+RULE=$(COLOR_RED)
+OPTS=$(COLOR_GREEN)
+NORM=$(REVERT_COLOR)
+
+# For improved speed
+CPUINFO=`cat /proc/cpuinfo | grep processor| wc -l`
+ifeq ($(CPUINFO), 1)
+   NUM_PARALLEL=1
+else
+      NUM_PARALLEL=$(shell echo $(CPUINFO) - 1 |bc)
+endif
+
+ifeq ($(FAST), 1)
+      NUM_PARALLEL=$(shell echo $(CPUINFO) + 2 |bc)
+endif
+
+PARALLEL_COMP=-j $(NUM_PARALLEL)
+
+# Different options to O1 build
+# # Other apsects of tool chain set here
+# # These should be made available appropriately to the builds
+ifeq ($(MACHINE),BIT64)
+CC          =gcc -m64
+CCPP        =g++ -m64
+else
+CC          =gcc -m32
+CCPP        =g++ -m32
+endif
+
+CC1= $(CC)
+CCPP1= $(CCPP)
+
+
+# The include options get merged with the options needed by
+# # the called makefiles and hence we export these to make them
+# # available to them.
+BUILD=i686-linux
+
+# The called makefiles depend on these macros and these need to be exported
+export PLTFRM
+export PLTFRM_FLAGS
+export BUILD
+export I_OPTS
+
+# Add to the linker options the platform specific components
+#L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp
+L_OPTS=-lsysrepo -lyang
+L_OPTS+= -lsysrepo-cpp -lyang-cpp
+L_OPTS+= -lm -lpthread
+
+# Export some of the flags expected from the command line.
+# # These macros are made available for the makefiles called from this makefile
+export MACHINE
+
+help:
+               @echo -e "******************************************************************"
+               @echo -e "BUILD COMMAND            DESCRIPTION                              "
+               @echo -e "------------------------------------------------------------------"
+               @echo -e "$(RULE)o1        - Builds all components of O1$(NORM)"
+               @echo -e "$(RULE)clean_o1  - clean up O1$(NORM)"
+               @echo -e "$(RULE)clean_all - cleanup O1 and all directories$(NORM)"
+               @echo -e "$(OPTS)  options: $(NORM)"
+               @echo -e "$(OPTS)    MACHINE=BIT64/BIT32  - Default is BIT32$(NORM)"
+               @echo -e "******************************************************************"
+
+prepare_dirs:
+       $(Q)echo -e "Preparing directories for build..."
+       $(Q)mkdir -p $(BUILD_DIR)/obj/o1
+       $(Q)mkdir -p $(LIB_ROOT)/o1
+       $(Q)mkdir -p $(BIN_DIR)/o1
+       $(Q)echo -e "Directories are successfully prepared"
+
+o1_mod:
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak OBJ_DIR=$(OBJ_ROOT)/o1 LIB_DIR=$(LIB_ROOT)/o1 LOG_DIR=$(LOG_ROOT)/o1 CC='$(CCPP1)'
+
+link_o1: o1_mod
+               $(Q)$(CCPP1) -g -o $(OBJ_ROOT)/o1/o1 -Wl,-R../lib/:. $(OBJ_ROOT)/o1/*.o\
+                       $(L_OPTS) -L$(LIB_ROOT)/o1
+
+clean_o1: 
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1.mak clean OBJ_DIR=$(OBJ_ROOT)/o1 LIB_DIR=$(LIB_ROOT)/o1 LOG_DIR=$(LOG_ROOT)/o1 CC='$(CC1)'
+               $(Q)rm -rf $(OBJ_ROOT)/o1/*
+               $(Q)rm -rf $(LIB_ROOT)/o1/*
+               $(Q)rm -rf $(BIN_DIR)/o1/*
+               $(Q)echo -e "***** O1 CLEAN COMPLETE *****"
+
+clean_all: clean_o1
+                         $(Q)rm -rf $(OBJ_ROOT)
+                         $(Q)rm -rf $(LIB_ROOT)
+                         $(Q)rm -rf $(LOG_ROOT)
+                         $(Q)rm -rf $(BIN_DIR)
+
+copy_build: link_o1
+                       $(Q)cp -f ./obj/o1/o1 ./bin/o1
+                       $(Q)echo -e "***** O1 BUILD COMPLETE *****"
+
+o1: prepare_dirs copy_build
+
+#######################################################################
+#         End of file                                                 #
+#######################################################################
index 634fc7a..0d84ee0 100644 (file)
@@ -162,6 +162,7 @@ du:
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
 
 link_du: du
                   $(Q)$(CC1) -g -o $(OBJ_ROOT)/odu/odu -Wl,-R../lib/:. $(OBJ_ROOT)/odu/*.o\
@@ -180,6 +181,8 @@ clean_odu:
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/mt.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/rl.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
                $(Q)$(MAKE) -f $(COM_BUILD_DIR)/phy_stub.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+               $(Q)$(MAKE) -f $(COM_BUILD_DIR)/o1_client.mak clean OBJ_DIR=$(OBJ_ROOT)/odu LIB_DIR=$(LIB_ROOT)/odu LOG_DIR=$(LOG_ROOT)/odu CC='$(CC1)'
+
                $(Q)rm -rf $(OBJ_ROOT)/odu/*
                $(Q)rm -rf $(LIB_ROOT)/odu/*
                $(Q)rm -rf $(BIN_DIR)/odu/*
@@ -264,3 +267,6 @@ odu: prepare_dirs copy_build
 cu_stub: prepare_cu_dirs cu link_cu
 ric_stub: prepare_ric_dirs ric link_ric
 
+#######################################################################
+#         End of file                                                 #
+#######################################################################