blob: 35e3542b43f04d23322a3b8bf07de120ba199a11 [file] [log] [blame]
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +00001#==================================================================================
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.
E. Scott Daniels412d53d2019-05-20 20:00:52 +000022# 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#
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000029
30.EXPORT_ALL_VARIABLES:
31.ONESHELL:
E. Scott Daniels4c42c802019-05-13 15:03:36 +000032#.SHELLFLAGS = -e # hosed on some flavours so keep it off
E. Scott Daniels412d53d2019-05-20 20:00:52 +000033SHELL ?= /bin/ksh
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000034
35build_path ?= ../../.build
E. Scott Daniels412d53d2019-05-20 20:00:52 +000036header_path := $(shell find $(build_path) -name 'rmr.h' |head -1 | sed 's!/rmr/.*!!' )
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000037
38C_INCLUDE_PATH := $(header_path)
39LD_LIBRARY_PATH=$(build_path):$(build_path)/lib
40LIBRARY_PATH = $(LD_LIBRARY_PATH)
41
42# These programmes are designed to test some basic application level functions
E. Scott Daniels412d53d2019-05-20 20:00:52 +000043# from the perspective of two, or more, communicating processes.
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000044
45
46.PHONY: all
E. Scott Daniels412d53d2019-05-20 20:00:52 +000047all: sender receiver sender_nano receiver_nano caller mt_receiver
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000048
49receiver_nano: receiver.c
50 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr -lnanomsg -lpthread -lm
51
52receiver: receiver.c
53 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
54
E. Scott Daniels412d53d2019-05-20 20:00:52 +000055mt_receiver: receiver.c
56 gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
57
E. Scott Daniels39257742019-06-06 16:44:33 +000058lreceiver: lreceiver.c
59 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
60
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000061sender_nano: sender.c
62 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr -lnanomsg -lpthread -lm
63
64sender: sender.c
65 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
66
E. Scott Daniels412d53d2019-05-20 20:00:52 +000067caller: caller.c
68 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000069
E. Scott Daniels39257742019-06-06 16:44:33 +000070lcaller: lcaller.c
71 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
72
E. Scott Danielscac756c2019-07-29 16:02:11 -040073lsender: lsender.c
74 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
E. Scott Daniels39257742019-06-06 16:44:33 +000075
E. Scott Daniels412d53d2019-05-20 20:00:52 +000076
77# clean removes intermediates; nuke removes everything that can be built
78.PHONY: clean nuke
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000079clean:
E. Scott Daniels412d53d2019-05-20 20:00:52 +000080 rm -f *.o
81
82nuke: clean
83 rm -f sender sender_nano receiver receiver_nano caller mt_receiver