1#
2# %CopyrightBegin%
3#
4# Copyright Ericsson AB 1997-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#
21# Copyright (C) 1997, Ericsson Telecommunications
22# Author: Kenneth Lundin
23#
24include $(ERL_TOP)/make/target.mk
25include $(ERL_TOP)/make/$(TARGET)/otp.mk
26
27# ----------------------------------------------------
28# Application version
29# ----------------------------------------------------
30include ../vsn.mk
31VSN=$(ASN1_VSN)
32
33# ----------------------------------------------------
34# Release directory specification
35# ----------------------------------------------------
36RELSYSDIR = $(RELEASE_PATH)/lib/asn1-$(VSN)
37
38
39
40
41#
42# Common Macros
43#
44
45EBIN = ../ebin
46
47EVAL_CT_MODULES = asn1ct_eval_ext
48
49CT_MODULES= \
50	asn1ct \
51	asn1ct_check \
52	asn1_db \
53	asn1ct_pretty_format \
54	asn1ct_func \
55	asn1ct_gen \
56	asn1ct_gen_check \
57	asn1ct_gen_per \
58	asn1ct_name \
59	asn1ct_constructed_per \
60	asn1ct_constructed_ber_bin_v2 \
61	asn1ct_gen_ber_bin_v2 \
62	asn1ct_gen_jer \
63	asn1ct_imm \
64	asn1ct_rtt \
65	asn1ct_value \
66	asn1ct_tok \
67	asn1ct_parser2 \
68	asn1ct_table \
69	$(EVAL_CT_MODULES)
70
71RT_MODULES= \
72	asn1rt_nif
73
74MODULES= $(CT_MODULES) $(RT_MODULES)
75
76ERL_FILES = $(MODULES:%=%.erl)
77
78TARGET_FILES = $(MODULES:%=$(EBIN)/%.$(EMULATOR))
79
80GENERATED_PARSER = $(PARSER_MODULE:%=%.erl)
81
82# internal hrl file
83HRL_FILES = asn1_records.hrl
84
85APP_FILE = asn1.app
86APPUP_FILE = asn1.appup
87
88APP_SRC = $(APP_FILE).src
89APP_TARGET = $(EBIN)/$(APP_FILE)
90
91APPUP_SRC = $(APPUP_FILE).src
92APPUP_TARGET = $(EBIN)/$(APPUP_FILE)
93
94EXAMPLES = \
95	../examples/P-Record.asn
96
97# ----------------------------------------------------
98# FLAGS
99# ----------------------------------------------------
100
101ERL_COMPILE_FLAGS += \
102	-I$(ERL_TOP)/lib/stdlib \
103	-Werror
104
105YRL_FLAGS =
106
107# ----------------------------------------------------
108# Targets
109# ----------------------------------------------------
110
111debug opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
112
113
114clean:
115	rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(GENERATED_PARSER)
116	rm -f core *~
117
118docs:
119
120
121info:
122	@echo "PARSER_SRC: $(PARSER_SRC)"
123	@echo "INSTALL_DATA: $(INSTALL_DATA)"
124# ----------------------------------------------------
125# Special Build Targets
126# ----------------------------------------------------
127
128$(EBIN)/asn1ct.$(EMULATOR):asn1ct.erl
129	 $(V_ERLC) -b$(EMULATOR) -o$(EBIN) $(ERL_COMPILE_FLAGS) -Dvsn=\"$(VSN)\" $<
130
131$(EBIN)/asn1ct_func.$(EMULATOR): asn1ct_func.erl
132	 $(V_ERLC) -o$(EBIN) $(ERL_COMPILE_FLAGS) -I../rt_templates $<
133
134asn1ct_eval_%.erl: asn1ct_eval_%.funcs
135	$(gen_verbose)erl -pa $(EBIN) -noshell -noinput \
136	   -run prepare_templates gen_asn1ct_eval $<
137
138$(APP_TARGET): $(APP_SRC) ../vsn.mk
139	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
140
141$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
142	$(vsn_verbose)sed -e 's;%VSN%;$(VSN);' $< > $@
143
144
145# ----------------------------------------------------
146# Release Target
147# ----------------------------------------------------
148include $(ERL_TOP)/make/otp_release_targets.mk
149
150release_spec: opt
151	$(INSTALL_DIR) "$(RELSYSDIR)/ebin"
152	$(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) "$(RELSYSDIR)/ebin"
153	$(INSTALL_DIR) "$(RELSYSDIR)/src"
154	$(INSTALL_DATA)  $(ERL_FILES) $(HRL_FILES) $(APP_SRC) $(APPUP_SRC) "$(RELSYSDIR)/src"
155	$(INSTALL_DIR) "$(RELSYSDIR)/examples"
156	$(INSTALL_DATA) $(EXAMPLES) "$(RELSYSDIR)/examples"
157
158# there are no include files to be used by the user
159#$(INSTALL_DIR) "$(RELSYSDIR)/include"
160#$(INSTALL_DATA) $(HRL_FILES) "$(RELSYSDIR)/include"
161
162release_docs_spec:
163
164#
165# Run-time library template files.
166#
167
168RT_TEMPLATES = asn1rtt_check \
169	       asn1rtt_ext \
170	       asn1rtt_per_common \
171               asn1rtt_real_common \
172	       asn1rtt_ber \
173               asn1rtt_jer \
174	       asn1rtt_per \
175	       asn1rtt_uper
176
177RT_TEMPLATES_ERL = $(RT_TEMPLATES:%=%.erl)
178RT_TEMPLATES_TARGET = $(RT_TEMPLATES:%=%.$(EMULATOR))
179
180asn1ct_rtt.erl: prepare_templates.$(EMULATOR) $(RT_TEMPLATES_TARGET)
181	$(gen_verbose)erl -noshell -noinput -run prepare_templates gen_asn1ct_rtt \
182           $(RT_TEMPLATES_TARGET)
183
184prepare_templates.$(EMULATOR): prepare_templates.erl
185	$(V_ERLC) prepare_templates.erl
186
187asn1rtt_%.$(EMULATOR): asn1rtt_%.erl
188	$(V_ERLC) +debug_info $<
189
190$(EVAL_CT_MODULES:%=%.erl): prepare_templates.$(EMULATOR) \
191			    $(EBIN)/asn1ct_rtt.$(EMULATOR) \
192			    $(EBIN)/asn1ct_func.$(EMULATOR) \
193
194#
195# Dependencies
196#
197
198$(EBIN)/asn1_app.beam: asn1_app.erl
199$(EBIN)/asn1_db.beam: asn1_db.erl
200$(EBIN)/asn1ct.beam: asn1ct.erl asn1_records.hrl
201$(EBIN)/asn1ct_check.beam: asn1ct_check.erl asn1_records.hrl
202$(EBIN)/asn1ct_constructed_ber_bin_v2.beam: asn1ct_constructed_ber_bin_v2.erl \
203  asn1_records.hrl
204$(EBIN)/asn1ct_constructed_per.beam: asn1ct_constructed_per.erl asn1_records.hrl
205$(EBIN)/asn1ct_func.beam: asn1ct_func.erl
206$(EBIN)/asn1ct_gen.beam: asn1ct_gen.erl asn1_records.hrl
207$(EBIN)/asn1ct_gen_ber_bin_v2.beam: asn1ct_gen_ber_bin_v2.erl asn1_records.hrl
208$(EBIN)/asn1ct_gen_check.beam: asn1_records.hrl
209$(EBIN)/asn1ct_gen_per.beam: asn1ct_gen_per.erl asn1_records.hrl
210$(EBIN)/asn1ct_gen_per_rt2ct.beam: asn1ct_gen_per_rt2ct.erl asn1_records.hrl
211$(EBIN)/asn1ct_imm.beam: asn1ct_imm.erl
212$(EBIN)/asn1ct_name.beam: asn1ct_name.erl
213$(EBIN)/asn1ct_parser2.beam: asn1ct_parser2.erl asn1_records.hrl
214$(EBIN)/asn1ct_pretty_format.beam: asn1ct_pretty_format.erl
215$(EBIN)/asn1ct_table.beam: asn1ct_table.erl
216$(EBIN)/asn1ct_tok.beam: asn1ct_tok.erl
217$(EBIN)/asn1ct_value.beam: asn1ct_value.erl asn1_records.hrl
218$(EBIN)/asn1rt.beam: asn1rt.erl
219$(EBIN)/asn1rt_ber_bin.beam: asn1rt_ber_bin.erl asn1_records.hrl
220$(EBIN)/asn1rt_ber_bin_v2.beam: asn1rt_ber_bin_v2.erl
221$(EBIN)/asn1rt_check.beam: asn1rt_check.erl
222$(EBIN)/asn1rt_nif.beam: asn1rt_nif.erl
223$(EBIN)/asn1rt_per_bin_rt2ct.beam: asn1rt_per_bin_rt2ct.erl asn1_records.hrl
224$(EBIN)/asn1rt_uper_bin.beam: asn1rt_uper_bin.erl asn1_records.hrl
225