enhance(API): Add multi-threaded call
[ric-plt/lib/rmr.git] / test / app_test / Makefile
1 #==================================================================================
2 #    Copyright (c) 2019 Nokia
3 #    Copyright (c) 2018-2019 AT&T Intellectual Property.
4 #
5 #   Licensed under the Apache License, Version 2.0 (the "License");
6 #   you may not use this file except in compliance with the License.
7 #   You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #   Unless required by applicable law or agreed to in writing, software
12 #   distributed under the License is distributed on an "AS IS" BASIS,
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #   See the License for the specific language governing permissions and
15 #   limitations under the License.
16 #==================================================================================
17 #
18
19 # NOTE:  this makefile assumes that RMr has been built using the directory .build
20 #               at the top most repo directory (e.g. ../../.build). It can be changed 
21 #               if you need to by adding "build_path=<path>" to the make command line.
22 #               To use this makefile to build on a system where RMr is already installed
23 #               try:    make build_path=/usr/local/lib
24 #
25 #               By default we prefer the Korn shell (it's just better). If you really need
26 #               to build with a dfferent shell add "SHELL=path" to the command line:
27 #                               make SHELL=/bin/bash
28 #
29
30 .EXPORT_ALL_VARIABLES:
31 .ONESHELL:
32 #.SHELLFLAGS = -e       # hosed on some flavours so keep it off
33 SHELL ?= /bin/ksh
34
35 build_path ?= ../../.build
36 header_path := $(shell find $(build_path) -name 'rmr.h' |head -1 | sed 's!/rmr/.*!!' )
37
38 C_INCLUDE_PATH := $(header_path)
39 LD_LIBRARY_PATH=$(build_path):$(build_path)/lib
40 LIBRARY_PATH = $(LD_LIBRARY_PATH)
41
42 # These programmes are designed to test some basic application level functions
43 # from the perspective of two, or more, communicating processes. 
44
45
46 .PHONY: all
47 all: sender receiver sender_nano receiver_nano caller mt_receiver
48
49 receiver_nano: receiver.c
50         gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr -lnanomsg -lpthread -lm
51
52 receiver: receiver.c
53         gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
54
55 mt_receiver: receiver.c
56         gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
57
58 sender_nano: sender.c
59         gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr -lnanomsg -lpthread -lm
60
61 sender: sender.c
62         gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
63
64 caller: caller.c
65         gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
66
67
68 # clean removes intermediates; nuke removes everything that can be built
69 .PHONY: clean nuke
70 clean:
71         rm -f *.o
72
73 nuke: clean
74         rm -f sender sender_nano receiver receiver_nano caller mt_receiver