97 lines
2.7 KiB
Makefile
97 lines
2.7 KiB
Makefile
# Makefile - IP network stack Makefile for nano and micro kernel
|
|
|
|
#
|
|
# Copyright (c) 2015 Intel Corporation
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
PIPE_BASE=/tmp/ip-stack
|
|
|
|
ifeq ($(MAKECMDGOALS),server)
|
|
QEMU_NUM=server
|
|
endif
|
|
ifeq ($(MAKECMDGOALS),client)
|
|
QEMU_NUM=client
|
|
endif
|
|
ifdef QEMU_NUM
|
|
QEMU_EXTRA_FLAGS += -serial none -serial pipe:${PIPE_BASE}-${QEMU_NUM} -pidfile qemu-${QEMU_NUM}.pid
|
|
else
|
|
QEMU_EXTRA_FLAGS = -serial none -serial unix:/tmp/slip.sock
|
|
endif
|
|
|
|
PIPE_SERVER_IN=${PIPE_BASE}-server.in
|
|
PIPE_SERVER_OUT=${PIPE_BASE}-server.out
|
|
PIPE_CLIENT_IN=${PIPE_BASE}-client.in
|
|
PIPE_CLIENT_OUT=${PIPE_BASE}-client.out
|
|
|
|
.PHONY: remove_pipes
|
|
remove_pipes:
|
|
rm -f ${PIPE_SERVER_IN} ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN} \
|
|
${PIPE_CLIENT_OUT}
|
|
|
|
${PIPE_SERVER_IN}:
|
|
mkfifo $@
|
|
${PIPE_SERVER_OUT}:
|
|
mkfifo $@
|
|
${PIPE_CLIENT_IN}:
|
|
mkfifo $@
|
|
${PIPE_CLIENT_OUT}:
|
|
mkfifo $@
|
|
LINK_CLIENT_PIPES:
|
|
ln ${PIPE_SERVER_IN} ${PIPE_CLIENT_OUT}
|
|
ln ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN}
|
|
|
|
.PHONY: PIPE_CLIENT_IN_LINK
|
|
PIPE_CLIENT_IN_LINK: ${PIPE_SERVER_IN}
|
|
-ln ${PIPE_SERVER_IN} ${PIPE_CLIENT_OUT}
|
|
|
|
.PHONY: PIPE_CLIENT_OUT_LINK
|
|
PIPE_CLIENT_OUT_LINK: ${PIPE_SERVER_OUT}
|
|
-ln ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN}
|
|
|
|
# Setup the dual qemu test case with pcap support (two qemus passing data
|
|
# between them and saving data to pcap via help of monitor applicaiton)
|
|
.PHONY: setup_pipes_dual_monitor
|
|
setup_pipes_dual_monitor: ${PIPE_SERVER_IN} ${PIPE_SERVER_OUT} ${PIPE_CLIENT_IN} ${PIPE_CLIENT_OUT}
|
|
|
|
# Setup the dual qemu test case with (two qemus passing data
|
|
# between them)
|
|
.PHONY: setup_pipes
|
|
setup_pipes: ${PIPE_SERVER_IN} ${PIPE_SERVER_OUT} LINK_CLIENT_PIPES
|
|
|
|
export QEMU_NUM
|
|
export QEMU_EXTRA_FLAGS
|
|
|
|
PID_FILE=/tmp/monitor_15_4.pid
|
|
|
|
hosttoolsmake = @$(MAKE) -C $(ZEPHYR_BASE)/net/ip/tools $1
|
|
|
|
${ZEPHYR_BASE}/net/ip/tools/monitor_15_4:
|
|
$(Q)$(call hosttoolsmake,monitor_15_4)
|
|
|
|
.PHONY: start_monitor
|
|
start_monitor: ${ZEPHYR_BASE}/net/ip/tools/monitor_15_4
|
|
${ZEPHYR_BASE}/net/ip/tools/monitor_15_4 \
|
|
server-client-monitor.pcap \
|
|
${PIPE_BASE}-server ${PIPE_BASE}-client > /dev/null & \
|
|
echo "$$!" > ${PID_FILE}
|
|
|
|
server: remove_pipes setup_pipes $(DOTCONFIG)
|
|
$(Q)$(call zephyrmake,$(O),qemu); true
|
|
$(Q)stty sane
|
|
|
|
client: $(DOTCONFIG)
|
|
$(Q)$(call zephyrmake,$(O),qemu); true
|
|
$(Q)stty sane
|