forked from EmbeddedRPC/erpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
168 lines (150 loc) · 7.86 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#-------------------------------------------------------------------------------
# Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
# Copyright 2016-2023 NXP
# All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
# SHALL FREESCALE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGE.
#-------------------------------------------------------------------------------
this_makefile := $(firstword $(MAKEFILE_LIST))
ERPC_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../)
include $(ERPC_ROOT)/mk/erpc_common.mk
TARGET_OUTPUT_ROOT = $(OUTPUT_ROOT)/$(DEBUG_OR_RELEASE)/$(os_name)/$(APP_NAME)
#-----------------------------------------------
# setup variables
# ----------------------------------------------
APP_NAME = erpcgen
PYTH_SCRIPT = erpcgen/bin/txt_to_c.py
#-----------------------------------------------
# Include path. Add the include paths like this:
# INCLUDES += ./include/
#-----------------------------------------------
INCLUDES += $(ERPC_ROOT) \
$(ERPC_ROOT)/erpcgen/src \
$(ERPC_ROOT)/erpcgen/src/cpptemplate \
$(ERPC_ROOT)/erpcgen/src/types \
$(ERPC_ROOT)/erpc_c/infra \
$(OBJS_ROOT)
ifeq "$(is_mingw)" "1"
INCLUDES += $(VISUAL_STUDIO_ROOT)
endif
SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
$(OBJS_ROOT)/erpcgen_lexer.cpp \
$(ERPC_ROOT)/erpcgen/src/cpptemplate/cpptempl.cpp \
$(ERPC_ROOT)/erpcgen/src/format_string.cpp \
$(ERPC_ROOT)/erpcgen/src/HexValues.cpp \
$(ERPC_ROOT)/erpcgen/src/Logging.cpp \
$(ERPC_ROOT)/erpcgen/src/options.cpp \
$(ERPC_ROOT)/erpcgen/src/SearchPath.cpp \
$(ERPC_ROOT)/erpcgen/src/AstNode.cpp \
$(ERPC_ROOT)/erpcgen/src/AstWalker.cpp \
$(ERPC_ROOT)/erpcgen/src/UniqueIdChecker.cpp \
$(ERPC_ROOT)/erpcgen/src/CGenerator.cpp \
$(ERPC_ROOT)/erpcgen/src/PythonGenerator.cpp \
$(ERPC_ROOT)/erpcgen/src/JavaGenerator.cpp \
$(ERPC_ROOT)/erpcgen/src/erpcgen.cpp \
$(ERPC_ROOT)/erpcgen/src/ErpcLexer.cpp \
$(ERPC_ROOT)/erpcgen/src/Generator.cpp \
$(ERPC_ROOT)/erpcgen/src/InterfaceDefinition.cpp \
$(ERPC_ROOT)/erpcgen/src/SymbolScanner.cpp \
$(ERPC_ROOT)/erpcgen/src/Token.cpp \
$(ERPC_ROOT)/erpcgen/src/ParseErrors.cpp \
$(ERPC_ROOT)/erpcgen/src/Utils.cpp \
$(ERPC_ROOT)/erpcgen/src/types/Type.cpp \
$(ERPC_ROOT)/erpc_c/infra/erpc_crc16.cpp
# Prevent make from deleting these temp files.
.SECONDARY: $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
$(OBJS_ROOT)/erpcgen_lexer.cpp \
$(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_server_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_server_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_common_functions.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_client_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_client_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_server_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_server_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_crc.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_init.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_common.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_client.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_server.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_interface.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_global_init.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_struct.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_server.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_interface.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_enum.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_const.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_client.c \
SOURCES += $(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_interface_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_client_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_server_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_server_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/cpp_common_functions.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_client_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_client_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_server_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_server_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_crc.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_init.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_common.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_client.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_server.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_interface.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_global_init.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_struct.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_server.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_interface.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_enum.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_const.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/java_client.c \
OBJECT_DEP := $(OBJS_ROOT)/erpcgen_lexer.cpp
include $(ERPC_ROOT)/mk/targets.mk
# Release should be alwas static. Customers don't need install things.
ifeq "$(build)" "release"
# Except Darwin.
ifeq "$(is_darwin)" ""
LIBRARIES += -static
endif
endif
# Run flex
$(OBJS_ROOT)/erpcgen_lexer.cpp: $(ERPC_ROOT)/erpcgen/src/erpcgen_lexer.l $(OBJS_ROOT)/erpcgen_parser.tab.hpp | $(OBJECTS_DIRS)
@$(call printmessage,orange,Generating, $(subst $(ERPC_ROOT)/,,$<))
$(at)$(FLEX) $(LLFLAGS) -o $(OBJS_ROOT)/erpcgen_lexer.cpp $<
# Run bison
$(OBJS_ROOT)/erpcgen_parser.tab.cpp: $(OBJS_ROOT)/erpcgen_parser.tab.hpp
$(OBJS_ROOT)/erpcgen_parser.tab.hpp: $(ERPC_ROOT)/erpcgen/src/erpcgen_parser.y | $(OBJECTS_DIRS)
@$(call printmessage,orange,Generating, $(subst $(ERPC_ROOT)/,,$<))
$(at)$(BISON) $(YYFLAGS) -o $(OBJS_ROOT)/erpcgen_parser.tab.cpp $<
# Convert templates to C sources.
$(OBJS_ROOT)/%.c: $(ERPC_ROOT)/%.template
@$(call printmessage,orange,Converting, $(subst $(ERPC_ROOT)/,,$<))
$(at)$(mkdirc) -p $(dir $@) && $(PYTHON) $(ERPC_ROOT)/$(PYTH_SCRIPT) -o $@ $<
.PHONY: install
install: $(MAKE_TARGET)
@$(call printmessage,c,Installing, erpcgen in $(BIN_INSTALL_DIR))
$(at)$(mkdirc) -p $(BIN_INSTALL_DIR)
$(at)install $(MAKE_TARGET) $(BIN_INSTALL_DIR)
clean::
$(at)$(rmc) $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c