1#
2# %CopyrightBegin%
3#
4# Copyright Ericsson AB 1999-2016. 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# Point this at your version of OTP
22OTPROOT=/usr/local/otp/releases/otp_beam_sunos5_r7a
23
24# Type actual IC Version
25ICVSN=4.0.4
26
27# Type actual Erl Interface Vesrion
28EIVSN=3.2.2
29
30# Type actual Erl Interface Vesrion
31JIVSN=1.2
32
33# IDL file(s)
34IDLS=random.idl
35
36# Own C-server files
37CSRV=server callbacks
38
39# Own C-client files
40CCL=client
41
42# Generated C-server files
43GCSRVS=rmod_random__s
44
45# Generated C-server files
46GCCLS=rmod_random
47
48# Includes
49IFLAGS=-I$(OTPROOT)/lib/ic-$(ICVSN)/include \
50       -I$(OTPROOT)/lib/erl_interface-$(EIVSN)/include
51
52LDFLAGS=-L$(OTPROOT)/lib/ic-$(ICVSN)/priv/lib \
53	-L$(OTPROOT)/lib/erl_interface-$(EIVSN)/lib
54
55LDLIBS=-lic -lerl_interface -lei -lnsl -lsocket
56
57
58# Erlang compiler
59ERLC=$(OTPROOT)/bin/erlc
60
61# Erlang compiler flags.
62EFLAGS='+{scoped_op_calls,true}'
63
64# C compiler
65CC=gcc
66
67# C compiler flags
68CFLAGS=-ggdb -O2 -Wall $(IFLAGS)
69
70# Java compiler
71JAVAC=javac
72
73CLASSPATH= "./:$(OTPROOT)/lib/ic-$(ICVSN)/priv/ic.jar:$(OTPROOT)/lib/jinterface-$(JIVSN)/priv/OtpErlang.jar"
74JFLAGS=-classpath $(CLASSPATH) -O
75
76JGENJFILES = \
77	./rmod/_randomImplBase.java \
78	./rmod/random.java \
79	./rmod/randomHolder.java \
80	./rmod/_randomStub.java \
81	./rmod/randomHelper.java
82
83
84all: server client eall jall
85
86
87server:
88	$(ERLC) $(EFLAGS) '+{be,c_server}' $(IDLS)
89	$(CC) $(IFLAGS) -c $(CSRV:=.c) $(GCSRVS:=.c)
90	$(CC) $(CSRV:=.o) $(GCSRVS:=.o) -o $@ $(LDFLAGS) $(LDLIBS)
91
92client:
93	$(ERLC) $(EFLAGS) '+{be,c_client}' $(IDLS)
94	$(CC) $(IFLAGS) -c $(CCL:=.c) $(GCCLS:=.c)
95	$(CC) $(CCL:=.o) $(GCCLS:=.o) -o $@ $(LDFLAGS) $(LDLIBS)
96
97eall:
98	$(ERLC) $(EFLAGS) '+{be,erl_genserv}' $(IDLS)
99	$(ERLC) *.erl
100
101jall:
102	$(ERLC) $(EFLAGS) '+{be,java}' $(IDLS)
103	$(JAVAC) $(JFLAGS) */*.java *.java
104
105
106clean:
107	/bin/rm -rf $(GCCLS:=.o) $(GCCLS:=.c) $(GCSRVS:=.o) $(GCSRVS:=.c) $(CCL:=.o) $(CSRV:=.o) rmod.erl rmod_random.erl *.jam *.beam oe* *.h *.hrl *~ core server client *.class
108
109
110
111
112
113
114
115
116
117
118
119