E. Scott Daniels | d9de79a | 2019-10-31 09:20:33 -0400 | [diff] [blame] | 1 | # |
| 2 | #================================================================================= |
E. Scott Daniels | 02e8d49 | 2020-01-21 12:23:28 -0500 | [diff] [blame] | 3 | # Copyright (c) 2019-2020 Nokia |
| 4 | # Copyright (c) 2018-2020 AT&T Intellectual Property. |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 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 Daniels | ec88d3c | 2019-11-13 09:40:22 -0500 | [diff] [blame] | 20 | # NOTE: this makefile assumes that RMR has been built using the directory .build |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 21 | # 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 Daniels | ec88d3c | 2019-11-13 09:40:22 -0500 | [diff] [blame] | 23 | # To use this makefile to build on a system where RMR is already installed |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 24 | # 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 Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 30 | |
| 31 | .EXPORT_ALL_VARIABLES: |
| 32 | .ONESHELL: |
E. Scott Daniels | 4c42c80 | 2019-05-13 15:03:36 +0000 | [diff] [blame] | 33 | #.SHELLFLAGS = -e # hosed on some flavours so keep it off |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 34 | SHELL ?= /bin/ksh |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 35 | |
E. Scott Daniels | d9de79a | 2019-10-31 09:20:33 -0400 | [diff] [blame] | 36 | ex_cflags = $(shell echo $$EX_CFLAGS ) |
| 37 | |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 38 | build_path ?= ../../.build |
E. Scott Daniels | 1739800 | 2020-04-01 12:39:47 -0400 | [diff] [blame] | 39 | header_path := $(shell find $(build_path) -name 'rmr.h' 2>/dev/null |head -1 | sed 's!/rmr/.*!!' ) |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 40 | |
E. Scott Daniels | fc5c77b | 2020-02-21 13:24:29 -0500 | [diff] [blame] | 41 | # use from environment if there so as to allow build to reference installed base |
| 42 | C_INCLUDE_PATH ?= $(header_path) |
| 43 | LD_LIBRARY_PATH ?= $(build_path):$(build_path)/lib |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 44 | LIBRARY_PATH = $(LD_LIBRARY_PATH) |
| 45 | |
| 46 | # These programmes are designed to test some basic application level functions |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 47 | # from the perspective of two, or more, communicating processes. |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 48 | |
| 49 | |
E. Scott Daniels | ec88d3c | 2019-11-13 09:40:22 -0500 | [diff] [blame] | 50 | .PHONY: all all_si |
E. Scott Daniels | fc5c77b | 2020-02-21 13:24:29 -0500 | [diff] [blame] | 51 | all: sender receiver caller mt_receiver v_sender ex_rts_receiver sender_si receiver_si |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 52 | |
E. Scott Daniels | ec88d3c | 2019-11-13 09:40:22 -0500 | [diff] [blame] | 53 | all_si: sender_si receiver_si |
| 54 | |
| 55 | |
| 56 | # ------ nng based builds ------------------------------------------------------------ |
| 57 | |
E. Scott Daniels | 02e8d49 | 2020-01-21 12:23:28 -0500 | [diff] [blame] | 58 | %:%.c |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 59 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
| 60 | |
E. Scott Daniels | 02e8d49 | 2020-01-21 12:23:28 -0500 | [diff] [blame] | 61 | # special build as it reuses an existing source module |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 62 | mt_receiver: receiver.c |
| 63 | gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_nng -lnng -lpthread -lm |
| 64 | |
E. Scott Daniels | ec88d3c | 2019-11-13 09:40:22 -0500 | [diff] [blame] | 65 | |
| 66 | # ----- si test builds ------------------------------------------------------------- |
| 67 | |
E. Scott Daniels | 02e8d49 | 2020-01-21 12:23:28 -0500 | [diff] [blame] | 68 | %_si : %.c |
E. Scott Daniels | ec88d3c | 2019-11-13 09:40:22 -0500 | [diff] [blame] | 69 | gcc -I $${C_INCLUDE_PATH:-.} $< -g -o $@ -lrmr_si -lpthread -lm |
| 70 | |
E. Scott Daniels | 02e8d49 | 2020-01-21 12:23:28 -0500 | [diff] [blame] | 71 | # explicit rule because there is no mt_recever.c |
| 72 | mt_receiver_si: receiver.c |
| 73 | gcc -I $${C_INCLUDE_PATH:-.} -DMTC $< -g -o $@ -lrmr_si -lpthread -lm |
E. Scott Daniels | ec88d3c | 2019-11-13 09:40:22 -0500 | [diff] [blame] | 74 | |
| 75 | |
| 76 | # --------- housekeeping ----------------------------------------------------------- |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 77 | |
| 78 | # clean removes intermediates; nuke removes everything that can be built |
| 79 | .PHONY: clean nuke |
E. Scott Daniels | e8a5b2c | 2019-04-22 17:04:10 +0000 | [diff] [blame] | 80 | clean: |
E. Scott Daniels | 412d53d | 2019-05-20 20:00:52 +0000 | [diff] [blame] | 81 | rm -f *.o |
| 82 | |
| 83 | nuke: clean |
E. Scott Daniels | 2596b23 | 2019-08-30 12:58:54 -0400 | [diff] [blame] | 84 | rm -f sender receiver caller mt_receiver |