From b7d70385d963ea68381d48933a9a0b0e787fa767 Mon Sep 17 00:00:00 2001 From: Liu Long Date: Fri, 29 Jul 2022 14:02:42 +0800 Subject: [PATCH] SampleApplication: Add Makefile for the entire SampleApplication Add the Makefile in the SampleApplication root directory. User don't need to separate build the userapp and rtapp, just need make once at the SampleApplication root directory. Tracked-On #7820 Signed-off-by: Liu Long --- misc/sample_application/Makefile | 18 ++++++++++++++++++ misc/sample_application/rtvm/Makefile | 8 +++++--- misc/sample_application/uservm/Makefile | 17 ++++++++++++----- 3 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 misc/sample_application/Makefile diff --git a/misc/sample_application/Makefile b/misc/sample_application/Makefile new file mode 100644 index 000000000..1ceb7e486 --- /dev/null +++ b/misc/sample_application/Makefile @@ -0,0 +1,18 @@ +T := $(CURDIR) +OUT_DIR ?= $(shell mkdir -p $(T)/build;cd $(T)/build/;pwd) + +.PHONY: all userapp rtapp +all: userapp histapp rtapp + +userapp: + $(MAKE) -C $(T)/uservm OUT_DIR=$(OUT_DIR) +histapp: + cp $(T)/uservm/histapp.py $(OUT_DIR) +rtapp: + $(MAKE) -C $(T)/rtvm OUT_DIR=$(OUT_DIR) + +.PHONY: clean + +clean: + rm -rf $(OUT_DIR) + diff --git a/misc/sample_application/rtvm/Makefile b/misc/sample_application/rtvm/Makefile index f678b118d..3c25e3c77 100644 --- a/misc/sample_application/rtvm/Makefile +++ b/misc/sample_application/rtvm/Makefile @@ -1,12 +1,14 @@ CC = gcc -CP = g++ +CXX ?= g++ +T := $(CURDIR) +OUT_DIR ?= $(shell mkdir -p $(T)i/../build;cd $(T)/../build;pwd) CFLAGS = -Wall -Wextra -Wabi=11 -pedantic LDLIBS = -lrt -pthread all: rtApp.c - $(CC) $(CFLAGS) -o rtapp rtApp.c ivshmemlib.c + $(CXX) $(CFLAGS) -o $(OUT_DIR)/rtApp rtApp.c ivshmemlib.c clean: - rm rtapp + rm $(OUT_DIR)/rtApp diff --git a/misc/sample_application/uservm/Makefile b/misc/sample_application/uservm/Makefile index 764660382..06deb9f01 100644 --- a/misc/sample_application/uservm/Makefile +++ b/misc/sample_application/uservm/Makefile @@ -1,12 +1,19 @@ -CC = gcc -CP = g++ +CC ?= gcc +CXX ?= g++ +T := $(CURDIR) +OUT_DIR ?= $(shell mkdir -p $(T)i/../build;cd $(T)/../build;pwd) CFLAGS = -Wall -Wextra -Wabi=11 -pedantic LDLIBS = -lrt -pthread -all: userApp.cpp - $(CP) $(CFLAGS) -o userapp userApp.cpp ivshmemlib.c $(LDLIBS) +all: userApp histapp + +userApp: + $(CXX) $(CFLAGS) -o $(OUT_DIR)/userApp userApp.cpp ivshmemlib.c $(LDLIBS) +histapp: + cp $(T)/histapp.py $(OUT_DIR) clean: - rm userapp + rm $(OUT_DIR)/userApp + rm $(OUT_DIR)/histapp.py