1#-*-makefile-*-   ; force emacs to enter makefile-mode
2
3# %CopyrightBegin%
4#
5# Copyright Ericsson AB 1999-2016. All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11#     http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
19# %CopyrightEnd%
20
21.SUFFIXES: .erl .jam .beam .yrl .hrl .sgml .html .so .c .flex .flex.src
22
23
24CC     = gcc
25CFLAGS = -g -O2 -funroll-loops -Wall -fPIC
26FLEX   = flex
27PERL   = perl
28
29# ----------------------------------------------------
30#	Erlang language section
31# ----------------------------------------------------
32EMULATOR = beam
33ERLC_WFLAGS = -W
34ERLC = erlc $(ERLC_WFLAGS) $(ERLC_FLAGS)
35ERL.beam =  erl.beam -boot start_clean
36ERL.jam = erl -boot start_clean
37ERL = $(ERL.$(EMULATOR))
38
39ifndef EBIN
40EBIN = ../ebin
41endif
42
43ifndef ESRC
44ESRC = .
45endif
46
47$(EBIN)/%.jam: $(ESRC)/%.erl
48	$(ERLC) -bjam $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
49
50$(EBIN)/%.beam: $(ESRC)/%.erl
51	$(ERLC) -bbeam $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
52
53.erl.jam:
54	$(ERLC) -bjam $(ERL_COMPILE_FLAGS) -o$(dir $@) $<
55
56.erl.beam:
57	$(ERLC) -bbeam $(ERL_COMPILE_FLAGS) -o$(dir $@) $<
58
59#
60# When .erl files are automatically created GNU make removes them if
61# they were the result of a chain of implicit rules. To prevent this
62# we say that all .erl files are "precious".
63#
64.PRECIOUS: %.erl
65
66## Uncomment these lines and add .idl to suffixes above to have erlc
67## eat IDL files
68##.idl.erl:
69##      $(ERLC) $(IDL_FLAGS) $<
70
71.yrl.erl:
72	$(ERLC) $(YRL_FLAGS) $<
73
74.xrl.erl:
75	$(ERLC) $(XRL_FLAGS) $<
76
77##  generating app files
78
79$(EBIN)/%.app: $(ESRC)/%.app.src $(VSN_FILE)
80	sed -e 's;%VSN%;$(VSN);' $< > $@
81
82$(EBIN)/%.appup: $(ESRC)/%.appup.src $(VSN_FILE)
83	sed -e 's;%VSN%;$(VSN);' $< > $@
84
85
86.c.so:
87	$(CC) $(CFLAGS) -fpic -shared -o $*.so $< -lfl
88
89
90# ----------------------------------------------------
91#       Command macros
92# ----------------------------------------------------
93INSTALL = /usr/ucb/install -c
94INSTALL_DIR = /usr/ucb/install -c -d
95INSTALL_PROGRAM = ${INSTALL}
96INSTALL_DATA = ${INSTALL} -m 644
97
98