14ad4d802e1285917f52916c11a9b870589dcab1
[staging/basesystem.git] / nsframework / framework_unified / client / NS_UtilityCenter / src / makefile_PosixBasedOS001
1 #
2 # @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3 #
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
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
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 #
16
17 #
18 # Standard Module Makefile version 2.0
19 #
20
21 # Name of the componet (team/domain prefix '_' component name)
22 COMPONENT_NAME = NS_UtilityCenter
23
24 ifndef PRJ_ROOT
25 export PRJ_ROOT = $(CURDIR)/../
26 endif
27 include $(PRJ_ROOT)cfg/depends.mk
28
29 # Name of the componet (team/domain prefix '_' component name)
30 #  This must be the same as the RTC Component name and Eclipse Project Name
31 COMPONENT_NAME = NS_UtilityCenter
32
33 # Additive Compile Flags (Flags from initiating make process will still apply)
34 DEFS +=
35
36 # Set local includes and then the reference includes (priority order determines search path)
37 # Default pattern are any configuration includes (which would be things like PosixBasedOS001), local (Team) component directories,
38 # dependencies includes (other teams)
39 # Local (current component references should be in the form of
40 #  $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/directory
41 #  Example your public include directory would be
42 #  $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc
43 # Team references should only be to other's public includes such as
44 #  $(CC_IFLAG)$(TEAM_ROOT)NS_MessageCenter/inc
45 # Global (non-team) references should be only to other's public includes such
46 #  these are found in the depends include file and captured in the (DEPENDS_INCLUDES) variable
47 INCLUDES = \
48         $(CFG_INCS) \
49         $(CC_IFLAG)./ \
50         $(DEPENDS_INCLUDES) \
51         $(CC_IFLAG)$(TEAM_ROOT)$(COMPONENT_NAME)/inc \
52
53
54 # Do the same if you need to include library paths as well
55 #  Do an incremental in case additional library paths are defined
56 #  at the top-level make.  Use similar guidelines as for includes
57 #  for example to include a team component library it would be
58 #  $(TEAM_ROOT)NS_MessageCenter/lib/NS_MessageCenter/
59 LIB_PATHS += \
60   $(DEPENDS_LIB_PATHS) \
61
62
63 # Define binary outputs.  These can be libraries or executables.
64 #  Name a variable for each deliverable.  Suffixes should be
65 #  EXEC - For Executables -> output to the bin directory
66 #TIME_EXEC = $(BIN_PATH)time
67 #  LIB - For Static Libraries -> output to lib directory with specific naming
68 #MATH_LIB = $(LIB_PATH)$(LIB_PREFIX)math.$(LIB_EXT)
69 #  SLIB - For Shared Objects
70 #FRMWRK_SLIB = $(SLIB_PATH)frmwrk.$(SO_EXT)
71 #  LIB - Define the static library for utility functions
72 #
73 #
74 ifdef DYNAMIC
75         COMPONENT_LIB = $(SLIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(SO_EXT)
76 else
77         COMPONENT_LIB = $(LIB_PATH)$(LIB_PREFIX)$(COMPONENT_NAME)$(DEBUG_EXT).$(LIB_EXT)
78 endif
79
80 ## Sources Section
81
82 # Define Library & Executable Sources (on a per deliverable basis)
83 #  This includes sources located in subdirectories.
84
85 # Define generic line that pulls all c, cc, cpp files
86 # since your in the src folder is pull only files from there
87 COMPONENT_SRCS = \
88         $(wildcard *.c) \
89         $(wildcard *.cpp)
90
91 # Define sources that my not be local to your component
92 # here, you can define indivial files or wildcard from
93 # a different folder.
94 NON_LOCAL_SRCS = \
95
96
97 # List of all sources to be built.  Can be assembled from the other defintitions.
98 #  This only defines sources for the current directory, so if there are subdirectories
99 #  those are not included.  (Those are found in simple subdirectory makefiles that only
100 #  direct the building of sources, but no linking into a binary)
101 SOURCES = \
102         $(COMPONENT_SRCS) \
103         $(NON_LOCAL_SRCS) \
104
105
106
107 #
108 # Convert the source files to object files with correct folder location.
109 #
110 #
111 C_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.c ,$(SOURCES) ) ) ) )
112 CPP_LANG_OBJECTS = $(addprefix $(BLD_PATH),$(addsuffix .$(OBJ_EXT),$(basename $(filter %.cpp %.cc %.cxx,$(SOURCES) ) ) ) )
113
114
115 # List of all sources to be generated.  Can be assembled from the other defintitions.
116 OBJECTS = \
117         $(C_LANG_OBJECTS) \
118         $(CPP_LANG_OBJECTS)
119
120
121
122 # All headers that are dependencies.  Wildcard is easy to pickup local headers.
123 #  This is only to automate the rebuilding, all builds on the servers are cleans
124 #  So this is not a huge deal when building on a component level.
125 HEADERS = \
126         $(wildcard *.h) \
127         $(wildcard $(PRJ_ROOT)../$(COMPONENT_NAME)/inc/*.h) \
128
129
130 LIBRARIES = \
131         $(COMPONENT_LIB) \
132
133
134 # Make targets
135 #  Standard
136 all: banner module_dirs subdirs local library binary
137
138 base: banner module_dirs subdirs local
139
140 # Standard Building of Source Files (Default builds for all objects defined above)
141 $(C_LANG_OBJECTS): $(SOURCES) $(HEADERS)
142         $(CC_CMD)
143
144 $(CPP_LANG_OBJECTS): $(SOURCES) $(HEADERS)
145         $(CPP_CMD)
146
147 local: $(OBJECTS)
148
149 # Defines specific for each deliverable
150
151 # For a static library
152 $(COMPONENT_LIB): $(OBJECTS)
153 ifdef DYNAMIC
154 # For a dynamic library
155         $(SLIB_CMD)
156         $(HIDE_ECHO_FLAG)$(OBJCPY) --only-keep-debug $(@) $(@).debug
157         $(HIDE_ECHO_FLAG)$(OBJCPY) --strip-all $(@)
158         $(HIDE_ECHO_FLAG)$(OBJCPY) --add-gnu-debuglink=$(@).debug $(@)
159 else
160 # For a static library
161         $(AR_CMD)
162 endif
163
164 # Standard set of derived targets
165 library: base \
166         $(LIBRARIES)
167         @echo "***** `date` Done building library: $(COMPONENT_NAME) ******"
168
169 binary: base \
170         $(BINARIES)
171
172 # Subdirs should be to jump to subdirectories
173 #  standard form is of
174 #  $(MAKE) -C subdirectory_name $(MAKECMDGOALS)
175 subdirs:
176
177 clean:
178         -rm -f $(BINARIES)
179         -rm -f $(LIBRARIES)
180         -rm -f $(OBJECTS)
181         -rm -f $(COMPONENT_LIB).map
182         -rm -f $(COMPONENT_LIB).debug
183
184 -v:
185
186         @echo "objs: --> $(OBJECTS)"
187         @echo "sources: --> $(SOURCES)"
188         @echo "headers: --> $(HEADERS)"
189         @echo "includes: --> $(INCLUDES)"
190         @echo "lib: --> $(LIBRARIES)"
191         @echo "bin: --> $(BINARIES)"
192
193
194 module_dirs: build_dirs