blob: 670ca1fb4503e6fe04dd88438f66c6f181d2bfc8 [file] [log] [blame]
E. Scott Danielsd9de79a2019-10-31 09:20:33 -04001#
2#=================================================================================
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +00003# Copyright (c) 2019 Nokia
4# Copyright (c) 2018-2019 AT&T Intellectual Property.
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#
19
E. Scott Danielsec88d3c2019-11-13 09:40:22 -050020# NOTE: this makefile assumes that RMR has been built using the directory .build
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000021# at the top most repo directory (e.g. ../../.build). It can be changed
22# if you need to by adding "build_path=<path>" to the make command line.
E. Scott Danielsec88d3c2019-11-13 09:40:22 -050023# To use this makefile to build on a system where RMR is already installed
E. Scott Daniels412d53d2019-05-20 20:00:52 +000024# try: make build_path=/usr/local/lib
25#
26# By default we prefer the Korn shell (it's just better). If you really need
27# to build with a dfferent shell add "SHELL=path" to the command line:
28# make SHELL=/bin/bash
29#
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000030
31.EXPORT_ALL_VARIABLES:
32.ONESHELL:
E. Scott Daniels4c42c802019-05-13 15:03:36 +000033#.SHELLFLAGS = -e # hosed on some flavours so keep it off
E. Scott Daniels412d53d2019-05-20 20:00:52 +000034SHELL ?= /bin/ksh
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000035
E. Scott Danielsd9de79a2019-10-31 09:20:33 -040036ex_cflags = $(shell echo $$EX_CFLAGS )
37
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000038build_path ?= ../../.build
E. Scott Daniels412d53d2019-05-20 20:00:52 +000039header_path := $(shell find $(build_path) -name 'rmr.h' |head -1 | sed 's!/rmr/.*!!' )
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000040
41C_INCLUDE_PATH := $(header_path)
42LD_LIBRARY_PATH=$(build_path):$(build_path)/lib
43LIBRARY_PATH = $(LD_LIBRARY_PATH)
44
45# These programmes are designed to test some basic application level functions
E. Scott Daniels412d53d2019-05-20 20:00:52 +000046# from the perspective of two, or more, communicating processes.
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000047
48
E. Scott Danielsec88d3c2019-11-13 09:40:22 -050049.PHONY: all all_si
E. Scott Danielsd9de79a2019-10-31 09:20:33 -040050all: sender receiver caller mt_receiver v_sender ex_rts_receiver
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000051
E. Scott Danielsec88d3c2019-11-13 09:40:22 -050052all_si: sender_si receiver_si
53
54
55# ------ nng based builds ------------------------------------------------------------
56
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000057receiver: receiver.c
58 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
59
E. Scott Daniels412d53d2019-05-20 20:00:52 +000060mt_receiver: receiver.c
61 gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
62
E. Scott Daniels39257742019-06-06 16:44:33 +000063lreceiver: lreceiver.c
64 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
65
E. Scott Danielsd9de79a2019-10-31 09:20:33 -040066ex_rts_receiver: ex_rts_receiver.c
67 gcc $(ex_cflags) -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
68
69v_sender: v_sender.c
70 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
71
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000072sender: sender.c
73 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
74
E. Scott Daniels412d53d2019-05-20 20:00:52 +000075caller: caller.c
76 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000077
E. Scott Daniels39257742019-06-06 16:44:33 +000078lcaller: lcaller.c
79 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
80
E. Scott Danielscac756c2019-07-29 16:02:11 -040081lsender: lsender.c
E. Scott Danielsec88d3c2019-11-13 09:40:22 -050082 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm
83
84
85
86# ----- si test builds -------------------------------------------------------------
87
88sender_si: sender.c
89 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_si -lpthread -lm
90
91receiver_si: receiver.c
92 gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_si -lpthread -lm
93
94
95# --------- housekeeping -----------------------------------------------------------
E. Scott Daniels412d53d2019-05-20 20:00:52 +000096
97# clean removes intermediates; nuke removes everything that can be built
98.PHONY: clean nuke
E. Scott Danielse8a5b2c2019-04-22 17:04:10 +000099clean:
E. Scott Daniels412d53d2019-05-20 20:00:52 +0000100 rm -f *.o
101
102nuke: clean
E. Scott Daniels2596b232019-08-30 12:58:54 -0400103 rm -f sender receiver caller mt_receiver