1#
2# %CopyrightBegin%
3#
4# Copyright Ericsson AB 1996-2020. 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/stdlib/egen
23EBIN=$(BOOTSTRAP_TOP)/lib/stdlib/ebin
24endif
25
26include $(ERL_TOP)/make/target.mk
27include $(ERL_TOP)/make/$(TARGET)/otp.mk
28
29# ----------------------------------------------------
30# Application version
31# ----------------------------------------------------
32include ../vsn.mk
33VSN=$(STDLIB_VSN)
34
35# ----------------------------------------------------
36# Release directory specification
37# ----------------------------------------------------
38RELSYSDIR = $(RELEASE_PATH)/lib/stdlib-$(VSN)
39
40# ----------------------------------------------------
41# Target Specs
42# ----------------------------------------------------
43MODULES= \
44	array \
45	base64 \
46	beam_lib \
47	binary \
48	c \
49	calendar \
50	dets \
51	dets_server \
52	dets_sup \
53	dets_utils \
54	dets_v9 \
55	dict \
56	digraph \
57	digraph_utils \
58	edlin \
59	edlin_expand \
60	epp \
61	erl_abstract_code \
62	erl_anno \
63	erl_bits \
64	erl_compile \
65	erl_error \
66	erl_eval \
67	erl_expand_records \
68	erl_internal \
69	erl_lint \
70	erl_parse \
71	erl_posix_msg \
72	erl_pp \
73	erl_scan \
74	erl_tar \
75	error_logger_file_h \
76	error_logger_tty_h \
77	escript \
78	ets \
79	eval_bits \
80	file_sorter \
81	filelib \
82	filename \
83	gb_trees \
84	gb_sets \
85	gen \
86	gen_event \
87	gen_fsm \
88	gen_server \
89	gen_statem \
90	io \
91	io_lib \
92	io_lib_format \
93	io_lib_fread \
94	io_lib_pretty \
95	lists \
96	log_mf_h \
97	maps \
98	math \
99	ms_transform \
100	otp_internal \
101	orddict \
102	ordsets \
103	re \
104	pool \
105	proc_lib \
106	proplists \
107	qlc \
108	qlc_pt \
109	queue \
110	rand \
111	random \
112	sets \
113	shell \
114	shell_default \
115	slave \
116	sofs \
117	string \
118	supervisor \
119	supervisor_bridge \
120	sys \
121	timer \
122	unicode \
123	unicode_util \
124	uri_string \
125	win32reg \
126	zip
127
128HRL_FILES= \
129	../include/assert.hrl \
130	../include/erl_compile.hrl \
131	../include/erl_bits.hrl \
132	../include/ms_transform.hrl \
133	../include/qlc.hrl \
134	../include/zip.hrl
135
136INTERNAL_HRL_FILES= dets.hrl erl_tar.hrl
137
138ERL_FILES= $(MODULES:%=%.erl)
139
140TARGET_FILES= $(MODULES:%=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET)
141
142APP_FILE= stdlib.app
143
144APP_SRC= $(APP_FILE).src
145APP_TARGET= $(EBIN)/$(APP_FILE)
146
147APPUP_FILE= stdlib.appup
148
149APPUP_SRC= $(APPUP_FILE).src
150APPUP_TARGET= $(EBIN)/$(APPUP_FILE)
151
152# ----------------------------------------------------
153# FLAGS
154# ----------------------------------------------------
155
156ifeq ($(NATIVE_LIBS_ENABLED),yes)
157ERL_COMPILE_FLAGS += +native
158else
159ERL_COMPILE_FLAGS += -Werror
160endif
161ERL_COMPILE_FLAGS += -I../include -I../../kernel/include
162
163# ----------------------------------------------------
164# Targets
165# ----------------------------------------------------
166
167debug opt: $(TARGET_FILES)
168
169clean:
170	rm -f $(TARGET_FILES)
171	rm -f core
172	rm -f erl_parse.erl
173
174docs:
175
176# This is a trick so that the preloaded files will get the correct type
177# specifications.
178primary_bootstrap_compiler: \
179  $(BOOTSTRAP_COMPILER)/ebin/epp.beam \
180  $(BOOTSTRAP_COMPILER)/ebin/erl_anno.beam \
181  $(BOOTSTRAP_COMPILER)/ebin/erl_error.beam \
182  $(BOOTSTRAP_COMPILER)/ebin/erl_scan.beam \
183  $(BOOTSTRAP_COMPILER)/ebin/erl_parse.beam \
184  $(BOOTSTRAP_COMPILER)/ebin/erl_lint.beam \
185  $(BOOTSTRAP_COMPILER)/ebin/io.beam \
186  $(BOOTSTRAP_COMPILER)/ebin/otp_internal.beam
187
188$(BOOTSTRAP_COMPILER)/ebin/erl_parse.beam: erl_parse.yrl
189	$(gen_verbose)
190	$(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/egen erl_parse.yrl
191	$(V_at)$(ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $(BOOTSTRAP_COMPILER)/egen/erl_parse.erl
192
193$(BOOTSTRAP_TOP)/lib/stdlib/egen/erl_parse.erl: erl_parse.yrl
194	$(yecc_verbose)$(ERLC) $(YRL_FLAGS) -o$(BOOTSTRAP_TOP)/lib/stdlib/egen erl_parse.yrl
195
196$(BOOTSTRAP_COMPILER)/ebin/%.beam: %.erl
197	$(V_ERLC) -o $(BOOTSTRAP_COMPILER)/ebin $<
198
199# ----------------------------------------------------
200# Special Build Targets
201# ----------------------------------------------------
202
203$(APP_TARGET): $(APP_SRC) ../vsn.mk
204	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
205
206$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
207	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
208
209unicode_util.erl: ../uc_spec/*
210	escript ../uc_spec/gen_unicode_mod.escript
211
212# ----------------------------------------------------
213# Release Target
214# ----------------------------------------------------
215include $(ERL_TOP)/make/otp_release_targets.mk
216
217release_spec: opt
218	$(INSTALL_DIR) "$(RELSYSDIR)/src"
219	$(INSTALL_DATA) $(ERL_FILES) erl_parse.yrl "$(RELSYSDIR)/src"
220	$(INSTALL_DATA) $(INTERNAL_HRL_FILES) "$(RELSYSDIR)/src"
221	$(INSTALL_DIR) "$(RELSYSDIR)/include"
222	$(INSTALL_DATA) $(HRL_FILES) "$(RELSYSDIR)/include"
223	$(INSTALL_DIR) "$(RELSYSDIR)/ebin"
224	$(INSTALL_DATA) $(TARGET_FILES) "$(RELSYSDIR)/ebin"
225
226release_docs_spec:
227
228# ----------------------------------------------------
229# Dependencies -- alphabetically, please
230# ----------------------------------------------------
231
232$(EBIN)/beam_lib.beam: ../include/erl_compile.hrl ../../kernel/include/file.hrl
233$(EBIN)/dets.beam: dets.hrl ../../kernel/include/file.hrl
234$(EBIN)/dets_server.beam: dets.hrl
235$(EBIN)/dets_utils.beam: dets.hrl
236$(EBIN)/dets_v9.beam: dets.hrl
237$(EBIN)/erl_bits.beam: ../include/erl_bits.hrl
238$(EBIN)/erl_compile.beam: ../include/erl_compile.hrl ../../kernel/include/file.hrl
239$(EBIN)/erl_lint.beam: ../include/erl_bits.hrl
240$(EBIN)/erl_tar.beam: ../../kernel/include/file.hrl erl_tar.hrl
241$(EBIN)/file_sorter.beam: ../../kernel/include/file.hrl
242$(EBIN)/filelib.beam: ../../kernel/include/file.hrl
243$(EBIN)/filename.beam: ../../kernel/include/file.hrl
244$(EBIN)/gen_event.beam: ../../kernel/include/logger.hrl
245$(EBIN)/gen_fsm.beam: ../../kernel/include/logger.hrl
246$(EBIN)/gen_server.beam: ../../kernel/include/logger.hrl
247$(EBIN)/gen_statem.beam: ../../kernel/include/logger.hrl
248$(EBIN)/proc_lib.beam: ../../kernel/include/logger.hrl
249$(EBIN)/qlc_pt.beam: ../include/ms_transform.hrl
250$(EBIN)/shell.beam: ../../kernel/include/file.hrl
251$(EBIN)/supervisor.beam: ../../kernel/include/logger.hrl
252$(EBIN)/supervisor_bridge.beam: ../../kernel/include/logger.hrl
253$(EBIN)/zip.beam: ../include/zip.hrl ../../kernel/include/file.hrl
254