1 ################################################################################
2 # Copyright (c) [2017-2019] [Radisys] #
4 # Licensed under the Apache License, Version 2.0 (the "License"); #
5 # you may not use this file except in compliance with the License. #
6 # You may obtain a copy of the License at #
8 # http://www.apache.org/licenses/LICENSE-2.0 #
10 # Unless required by applicable law or agreed to in writing, software #
11 # distributed under the License is distributed on an "AS IS" BASIS, #
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13 # See the License for the specific language governing permissions and #
14 # limitations under the License. #
15 ################################################################################
17 # Master makefile for O1 module
19 # Identify the location our software which is used by rest
20 # of the build scripts
22 include ../common/rsys_fancy.mak
23 include ../common/env.mak
25 ROOT_DIR=$(patsubst %/build/o1,%,$(BUILD_DIR))
31 CPUINFO=`cat /proc/cpuinfo | grep processor| wc -l`
35 NUM_PARALLEL=$(shell echo $(CPUINFO) - 1 |bc)
39 NUM_PARALLEL=$(shell echo $(CPUINFO) + 2 |bc)
42 PARALLEL_COMP=-j $(NUM_PARALLEL)
44 # Different options to O1 build
45 # # Other apsects of tool chain set here
46 # # These should be made available appropriately to the builds
47 ifeq ($(MACHINE),BIT64)
59 # The include options get merged with the options needed by
60 # # the called makefiles and hence we export these to make them
61 # # available to them.
64 # The called makefiles depend on these macros and these need to be exported
70 # Add to the linker options the platform specific components
71 #L_OPTS+=-lnsl -lrt -lm -lpthread -lsctp
72 L_OPTS=-lsysrepo -lyang
73 L_OPTS+= -lsysrepo-cpp -lyang-cpp
74 L_OPTS+= -lm -lpthread
76 # Export some of the flags expected from the command line.
77 # # These macros are made available for the makefiles called from this makefile
81 @echo -e "******************************************************************"
82 @echo -e "BUILD COMMAND DESCRIPTION "
83 @echo -e "------------------------------------------------------------------"
84 @echo -e "$(RULE)o1 - Builds all components of O1$(NORM)"
85 @echo -e "$(RULE)clean_o1 - clean up O1$(NORM)"
86 @echo -e "$(RULE)clean_all - cleanup O1 and all directories$(NORM)"
87 @echo -e "$(OPTS) options: $(NORM)"
88 @echo -e "$(OPTS) MACHINE=BIT64/BIT32 - Default is BIT32$(NORM)"
89 @echo -e "******************************************************************"
92 $(Q)echo -e "Preparing directories for build..."
93 $(Q)mkdir -p $(BUILD_DIR)/obj/o1
94 $(Q)mkdir -p $(LIB_ROOT)/o1
95 $(Q)mkdir -p $(BIN_DIR)/o1
96 $(Q)echo -e "Directories are successfully prepared"
99 $(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)'
102 $(Q)$(CCPP1) -g -o $(OBJ_ROOT)/o1/o1 -Wl,-R../lib/:. $(OBJ_ROOT)/o1/*.o\
103 $(L_OPTS) -L$(LIB_ROOT)/o1
106 $(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)'
107 $(Q)rm -rf $(OBJ_ROOT)/o1/*
108 $(Q)rm -rf $(LIB_ROOT)/o1/*
109 $(Q)rm -rf $(BIN_DIR)/o1/*
110 $(Q)echo -e "***** O1 CLEAN COMPLETE *****"
113 $(Q)rm -rf $(OBJ_ROOT)
114 $(Q)rm -rf $(LIB_ROOT)
115 $(Q)rm -rf $(LOG_ROOT)
116 $(Q)rm -rf $(BIN_DIR)
119 $(Q)cp -f ./obj/o1/o1 ./bin/o1
120 $(Q)echo -e "***** O1 BUILD COMPLETE *****"
122 o1: prepare_dirs copy_build
124 #**********************************************************************
126 #**********************************************************************