E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 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. |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 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 | # |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 29 | |
| 30 | .EXPORT_ALL_VARIABLES: |
| 31 | .ONESHELL: |
E. Scott Daniels | 4c42c80 | 2019-05-13 15:03:36 +0000 | [diff] [blame] | 32 | #.SHELLFLAGS = -e # hosed on some flavours so keep it off |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 33 | SHELL ?= /bin/ksh |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 34 | |
| 35 | build_path ?= ../../.build |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 36 | header_path := $(shell find $(build_path) -name 'rmr.h' |head -1 | sed 's!/rmr/.*!!' ) |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 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 |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 43 | # from the perspective of two, or more, communicating processes. |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 44 | |
| 45 | |
| 46 | .PHONY: all |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 47 | all: sender receiver sender_nano receiver_nano caller mt_receiver |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 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 | |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 55 | mt_receiver: receiver.c |
| 56 | gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
| 57 | |
E. Scott Daniels | 3925774 | 2019-06-06 16:44:33 +0000 | [diff] [blame] | 58 | lreceiver: lreceiver.c |
| 59 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
| 60 | |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 61 | sender_nano: sender.c |
| 62 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr -lnanomsg -lpthread -lm |
| 63 | |
| 64 | sender: sender.c |
| 65 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
| 66 | |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 67 | caller: caller.c |
| 68 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 69 | |
E. Scott Daniels | 3925774 | 2019-06-06 16:44:33 +0000 | [diff] [blame] | 70 | lcaller: lcaller.c |
| 71 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
| 72 | |
E. Scott Daniels | cac756c | 2019-07-29 16:02:11 -0400 | [diff] [blame^] | 73 | lsender: lsender.c |
| 74 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
E. Scott Daniels | 3925774 | 2019-06-06 16:44:33 +0000 | [diff] [blame] | 75 | |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 76 | |
| 77 | # clean removes intermediates; nuke removes everything that can be built |
| 78 | .PHONY: clean nuke |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 79 | clean: |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 80 | rm -f *.o |
| 81 | |
| 82 | nuke: clean |
| 83 | rm -f sender sender_nano receiver receiver_nano caller mt_receiver |