1#
2# %CopyrightBegin%
3#
4# Copyright Ericsson AB 1996-2019. All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# %CopyrightEnd%
19#
20
21ifdef BOOTSTRAP
22EGEN=$(BOOTSTRAP_TOP)/lib/kernel/egen
23EBIN=$(BOOTSTRAP_TOP)/lib/kernel/ebin
24endif
25
26include $(ERL_TOP)/make/target.mk
27include $(ERL_TOP)/make/$(TARGET)/otp.mk
28
29# ----------------------------------------------------
30# Application version
31# ----------------------------------------------------
32
33# Include erts/system/vsn.mk to port number for EPMD -- we will
34# get an unwanted definition for VSN too.  Therefore,
35# we'll use KERNEL_VSN directly instead of assigning it to
36# VSN which is done in other Makefiles.  Same with HIPE_VSN.
37
38include ../vsn.mk
39include $(ERL_TOP)/erts/vsn.mk
40include $(ERL_TOP)/lib/hipe/vsn.mk
41
42include $(ERL_TOP)/erts/epmd/epmd.mk
43
44
45# ----------------------------------------------------
46# Release directory specification
47# ----------------------------------------------------
48RELSYSDIR = $(RELEASE_PATH)/lib/kernel-$(KERNEL_VSN)
49
50# ----------------------------------------------------
51# Target Specs
52# ----------------------------------------------------
53
54
55MODULES = \
56	application \
57	application_controller \
58	application_master \
59	application_starter \
60	auth \
61	code \
62	code_server \
63	disk_log \
64	disk_log_1 \
65	disk_log_server \
66	disk_log_sup \
67	dist_ac \
68	dist_util \
69	erl_boot_server \
70	erl_compile_server \
71	erl_ddll \
72	erl_distribution \
73	erl_epmd \
74	erl_reply \
75	erl_signal_handler \
76	erts_debug \
77	error_handler \
78	error_logger \
79	file \
80	file_io_server \
81	file_server \
82	gen_tcp \
83	gen_udp \
84	gen_sctp \
85	global \
86	global_group \
87	global_search \
88	group \
89	group_history \
90	heart \
91	hipe_unified_loader \
92	inet \
93	inet6_tcp \
94	inet6_tcp_dist \
95	inet6_udp \
96	inet6_sctp \
97	inet_config \
98	inet_db \
99	inet_dns \
100	inet_gethost_native \
101	inet_hosts \
102	inet_parse \
103	inet_res \
104	inet_tcp \
105	inet_tcp_dist \
106	inet_udp \
107	inet_sctp \
108	kernel \
109	kernel_config \
110	kernel_refc \
111	local_udp \
112	local_tcp \
113        logger \
114        logger_backend \
115        logger_config \
116	logger_handler_watcher \
117	logger_std_h \
118	logger_disk_log_h \
119	logger_h_common \
120	logger_filters \
121        logger_formatter \
122	logger_olp \
123	logger_proxy \
124        logger_server \
125        logger_simple_h \
126        logger_sup \
127	net \
128	net_adm \
129	net_kernel \
130	os \
131	pg2 \
132	ram_file \
133	rpc \
134	seq_trace \
135	standard_error \
136	user \
137	user_drv \
138	user_sup \
139	raw_file_io \
140	raw_file_io_compressed \
141	raw_file_io_inflate \
142	raw_file_io_deflate \
143	raw_file_io_delayed \
144	raw_file_io_list \
145	raw_file_io_raw \
146	wrap_log_reader
147
148HRL_FILES= ../include/file.hrl ../include/inet.hrl ../include/inet_sctp.hrl \
149	../include/dist.hrl ../include/dist_util.hrl \
150	../include/net_address.hrl ../include/logger.hrl
151
152INTERNAL_HRL_FILES= application_master.hrl disk_log.hrl \
153        erl_epmd.hrl file_int.hrl hipe_ext_format.hrl \
154        inet_dns.hrl inet_res.hrl \
155        inet_boot.hrl inet_config.hrl inet_int.hrl \
156	inet_dns_record_adts.hrl \
157	logger_internal.hrl logger_olp.hrl logger_h_common.hrl
158
159ERL_FILES= $(MODULES:%=%.erl)
160
161TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) \
162		       $(APP_TARGET) $(APPUP_TARGET)
163
164APP_FILE= kernel.app
165
166APP_SRC= $(APP_FILE).src
167APP_TARGET= $(EBIN)/$(APP_FILE)
168
169APPUP_FILE= kernel.appup
170
171APPUP_SRC= $(APPUP_FILE).src
172APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
173
174# ----------------------------------------------------
175# FLAGS
176# ----------------------------------------------------
177
178ifeq ($(NATIVE_LIBS_ENABLED),yes)
179ERL_COMPILE_FLAGS += +native
180else
181ERL_COMPILE_FLAGS += -Werror
182endif
183ERL_COMPILE_FLAGS += -I../include
184
185
186# ----------------------------------------------------
187# Targets
188# ----------------------------------------------------
189
190debug opt: $(TARGET_FILES)
191
192# Note: In the open-source build clean must not destroyed the preloaded
193# beam files.
194clean:
195	rm -f $(TARGET_FILES)
196	rm -f core
197
198
199docs:
200
201# ----------------------------------------------------
202# Special Build Targets
203# ----------------------------------------------------
204
205../../hipe/main/hipe.hrl: ../../hipe/vsn.mk ../../hipe/main/hipe.hrl.src
206	$(vsn_verbose)sed -e "s;%VSN%;$(HIPE_VSN);" ../../hipe/main/hipe.hrl.src > ../../hipe/main/hipe.hrl
207
208$(APP_TARGET): $(APP_SRC) ../vsn.mk
209	$(vsn_verbose)sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@
210
211$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
212	$(vsn_verbose)sed -e 's;%VSN%;$(KERNEL_VSN);' $< > $@
213
214
215EPMD_FLAGS = -Depmd_port_no=$(EPMD_PORT_NO)	\
216             -Depmd_node_type=$(EPMD_NODE_TYPE)	\
217             -Depmd_dist_low=$(EPMD_DIST_LOW)	\
218             -Depmd_dist_high=$(EPMD_DIST_HIGH)	\
219             -Derlang_daemon_port=$(EPMD_PORT_NO)
220
221$(ESRC)/inet_dns_record_adts.hrl: $(ESRC)/inet_dns_record_adts.pl
222	$(gen_verbose)LANG=C $(PERL) $< > $@
223
224$(EBIN)/erl_epmd.beam: $(ESRC)/erl_epmd.erl
225	$(V_ERLC) $(ERL_COMPILE_FLAGS) $(EPMD_FLAGS) -o$(EBIN) $<
226
227# ----------------------------------------------------
228# Release Target
229# ----------------------------------------------------
230include $(ERL_TOP)/make/otp_release_targets.mk
231
232release_spec: opt
233	$(INSTALL_DIR) "$(RELSYSDIR)/src"
234	$(INSTALL_DATA) $(ERL_FILES) "$(RELSYSDIR)/src"
235	$(INSTALL_DATA) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src"
236	$(INSTALL_DIR) "$(RELSYSDIR)/include"
237	$(INSTALL_DATA) $(HRL_FILES) "$(RELSYSDIR)/include"
238	$(INSTALL_DIR) "$(RELSYSDIR)/ebin"
239	$(INSTALL_DATA) $(TARGET_FILES) "$(RELSYSDIR)/ebin"
240
241release_docs_spec:
242
243
244# Include dependencies -- list below added by Kostis Sagonas
245$(EBIN)/application_controller.beam: application_master.hrl ../include/logger.hrl
246$(EBIN)/application_master.beam: application_master.hrl
247$(EBIN)/auth.beam: ../include/file.hrl
248$(EBIN)/code.beam: ../include/file.hrl
249$(EBIN)/code_server.beam: ../include/file.hrl
250$(EBIN)/disk_log.beam: disk_log.hrl
251$(EBIN)/disk_log_1.beam: disk_log.hrl ../include/file.hrl
252$(EBIN)/disk_log_server.beam: disk_log.hrl
253$(EBIN)/dist_util.beam: ../include/dist_util.hrl ../include/dist.hrl
254$(EBIN)/erl_boot_server.beam: inet_boot.hrl
255$(EBIN)/erl_epmd.beam: inet_int.hrl erl_epmd.hrl
256$(EBIN)/error_logger.beam: logger_internal.hrl ../include/logger.hrl
257$(EBIN)/file.beam: ../include/file.hrl file_int.hrl
258$(EBIN)/file_io_server.beam: ../include/file.hrl file_int.hrl
259$(EBIN)/gen_tcp.beam: inet_int.hrl
260$(EBIN)/gen_udp.beam: inet_int.hrl
261$(EBIN)/gen_sctp.beam: ../include/inet_sctp.hrl
262$(EBIN)/global.beam: ../../stdlib/include/ms_transform.hrl
263$(EBIN)/hipe_unified_loader.beam: ../../hipe/main/hipe.hrl hipe_ext_format.hrl
264$(EBIN)/inet.beam: ../include/inet.hrl inet_int.hrl ../include/inet_sctp.hrl
265$(EBIN)/inet6_tcp.beam: inet_int.hrl
266$(EBIN)/inet6_tcp_dist.beam: ../include/net_address.hrl ../include/dist.hrl ../include/dist_util.hrl
267$(EBIN)/inet6_udp.beam: inet_int.hrl
268$(EBIN)/inet6_sctp.beam: inet_int.hrl
269$(EBIN)/inet_config.beam: inet_config.hrl ../include/inet.hrl
270$(EBIN)/inet_db.beam: ../include/inet.hrl inet_int.hrl inet_res.hrl inet_dns.hrl inet_config.hrl
271$(EBIN)/inet_dns.beam: inet_int.hrl inet_dns.hrl inet_dns_record_adts.hrl
272$(EBIN)/inet_gethost_native.beam: ../include/inet.hrl
273$(EBIN)/inet_hosts.beam: ../include/inet.hrl
274$(EBIN)/inet_parse.beam: ../include/file.hrl
275$(EBIN)/inet_res.beam: ../include/inet.hrl inet_res.hrl inet_dns.hrl inet_int.hrl
276$(EBIN)/inet_tcp.beam: inet_int.hrl
277$(EBIN)/inet_udp_dist.beam: ../include/net_address.hrl ../include/dist.hrl ../include/dist_util.hrl
278$(EBIN)/inet_udp.beam: inet_int.hrl
279$(EBIN)/inet_sctp.beam: inet_int.hrl ../include/inet_sctp.hrl
280$(EBIN)/local_udp.beam: inet_int.hrl
281$(EBIN)/local_tcp.beam: inet_int.hrl
282$(EBIN)/logger.beam: logger_internal.hrl ../include/logger.hrl
283$(EBIN)/logger_backend.beam: logger_internal.hrl ../include/logger.hrl
284$(EBIN)/logger_config.beam: logger_internal.hrl ../include/logger.hrl
285$(EBIN)/logger_disk_log_h.beam: logger_h_common.hrl logger_internal.hrl ../include/logger.hrl ../include/file.hrl
286$(EBIN)/logger_filters.beam: logger_internal.hrl ../include/logger.hrl
287$(EBIN)/logger_formatter.beam: logger_internal.hrl ../include/logger.hrl
288$(EBIN)/logger_olp.beam: logger_olp.hrl logger_internal.hrl
289$(EBIN)/logger_proxy.beam: logger_internal.hrl
290$(EBIN)/logger_server.beam: logger_internal.hrl ../include/logger.hrl
291$(EBIN)/logger_simple_h.beam: logger_internal.hrl ../include/logger.hrl
292$(EBIN)/logger_std_h.beam: logger_h_common.hrl logger_internal.hrl ../include/logger.hrl ../include/file.hrl
293$(EBIN)/logger_h_common.beam: logger_h_common.hrl logger_internal.hrl ../include/logger.hrl
294$(EBIN)/net_kernel.beam: ../include/net_address.hrl
295$(EBIN)/os.beam: ../include/file.hrl
296$(EBIN)/ram_file.beam: ../include/file.hrl
297$(EBIN)/wrap_log_reader.beam: disk_log.hrl ../include/file.hrl
298$(EBIN)/raw_file_io.beam: ../include/file.hrl file_int.hrl
299$(EBIN)/raw_file_io_compressed.beam: ../include/file.hrl file_int.hrl
300$(EBIN)/raw_file_io_inflate.beam: ../include/file.hrl file_int.hrl
301$(EBIN)/raw_file_io_deflate.beam: ../include/file.hrl file_int.hrl
302$(EBIN)/raw_file_io_delayed.beam: ../include/file.hrl file_int.hrl
303$(EBIN)/raw_file_io_list.beam: ../include/file.hrl file_int.hrl
304$(EBIN)/raw_file_io_raw.beam: ../include/file.hrl file_int.hrl
305