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