summaryrefslogtreecommitdiff
path: root/examples/simple_talker
diff options
context:
space:
mode:
authorLevi Pearson <levi.pearson@harman.com>2017-02-03 18:03:37 -0700
committerLevi Pearson <levi.pearson@harman.com>2017-03-31 13:20:53 -0600
commite845e9bcf2a7651de1000e94e01b9e1a0f2aa937 (patch)
tree7e5f5dee18e0cf4fbdd12e9fe579a38ba5a39650 /examples/simple_talker
parent8af0629aa844b261b48f8bd45c5122e46dc8ce19 (diff)
downloadOpen-AVB-e845e9bcf2a7651de1000e94e01b9e1a0f2aa937.tar.gz
Split lib/common/avb.c/h into separate libraries
This allows pulling in gPTP client support without pulling in AVTP code and especially without pulling in a dependency on the igb library. No source had to change since avb.h just includes the broken-out headers, and there is a CPP option to include the avb_igb.h file. Makefiles were updated as well, including for all the examples that use the common avb code.
Diffstat (limited to 'examples/simple_talker')
-rw-r--r--examples/simple_talker/Makefile31
1 files changed, 22 insertions, 9 deletions
diff --git a/examples/simple_talker/Makefile b/examples/simple_talker/Makefile
index bba47b03..aef9c541 100644
--- a/examples/simple_talker/Makefile
+++ b/examples/simple_talker/Makefile
@@ -1,22 +1,35 @@
+AVBLIB_DIR = ../../lib/common
+AVBLIB_OBJS = avb_avtp.o avb_gptp.o avb_igb.o
+AVBLIB_TARGETS = $(addprefix $(AVBLIB_DIR)/,$(AVBLIB_OBJS))
+
+MRPCLIENT_DIR = ../common
+MRPTALKER_OBJS = talker_mrp_client.o
+MRPTALKER_TARGETS = $(addprefix $(MRPCLIENT_DIR)/,$(MRPTALKER_OBJS))
+
+IGBLIB_DIR = ../../lib/igb
+DAEMONS_DIR = ../../daemons
+
CC?=gcc
OPT=-O2 -g
-CFLAGS=$(OPT) -Wall -Wextra -Wno-parentheses
-INCFLAGS=-I../../lib/igb -I../../daemons/mrpd -I../common -I../../lib/common -I../../daemons/common
+WARN=-Wall -Wextra -Wno-parentheses
+CFLAGS=$(OPT) $(WARN)
+CPPFLAGS=-I$(IGBLIB_DIR) -I$(DAEMONS_DIR)/mrpd -I$(MRPCLIENT_DIR) -I$(AVBLIB_DIR) -I$(DAEMONS_DIR)/common
LDLIBS=-ligb -lpci -lrt -lm -pthread
-LDFLAGS=-L../../lib/igb
+LDFLAGS=-L$(IGBLIB_DIR)
+
+.PHONY: all clean
all: simple_talker
-simple_talker: simple_talker.o ../common/talker_mrp_client.o ../../lib/common/avb.o
+simple_talker: simple_talker.o $(MRPTALKER_TARGETS) $(AVBLIB_TARGETS)
simple_talker.o: simple_talker.c
- $(CC) $(CFLAGS) $(INCFLAGS) -c simple_talker.c
-../../lib/common/avb.o: ../../lib/common/avb.h ../../lib/common/avb.c
- make -C ../../lib/common/ avb.o
+$(AVBLIB_DIR)/%.o: $(AVBLIB_DIR)/%.h $(AVBLIB_DIR)/%.c
+ make -C $(AVBLIB_DIR) $@
-../common/talker_mrp_client.o: ../common/talker_mrp_client.c ../common/talker_mrp_client.h
- make -C ../common/ talker_mrp_client.o
+$(MRPCLIENT_DIR)/%.o: $(MRPCLIENT_DIR)/%.c $(MRPCLIENT_DIR)/%.h
+ make -C $(MRPCLIENT_DIR) $@
%: %.o
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@