From 20d375f33ae37da26603120d8daa77f1e428b046 Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Tue, 15 May 2018 09:09:20 +0800 Subject: [PATCH] add a makefile under project root directory it can be used as following: make ==> to make hypervisor & devicemodel & tools also modify tools makefile to support out-dir setting. Signed-off-by: Minggui Cao Reviewed-by: Jack Ren --- .gitignore | 1 + Makefile | 39 +++++++++++++++++++++++++++++++++++++ tools/acrn-manager/Makefile | 5 ++++- tools/acrnlog/Makefile | 5 ++++- tools/acrntrace/Makefile | 5 ++++- 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 0c0a578ac..ee0ec4b4a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ devicemodel/build/ devicemodel/include/version.h doc/doxygen doc/_build +build *.bak *.sav *.log diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..a4e9158f4 --- /dev/null +++ b/Makefile @@ -0,0 +1,39 @@ + +# global helper variables +T := $(CURDIR) +PLAT := uefi +RELEASE := 0 + +ROOT_OUT := $(T)/build +HV_OUT := $(ROOT_OUT)/hypervisor +DM_OUT := $(ROOT_OUT)/devicemodel +TOOLS_OUT := $(ROOT_OUT)/tools + +.PHONY: all hypervisor devicemodel tools +all: hypervisor devicemodel tools + +hypervisor: + cd $(T)/hypervisor; \ + make HV_OBJDIR=$(HV_OUT) PLATFORM=$(PLAT) RELEASE=$(RELEASE) clean; \ + make HV_OBJDIR=$(HV_OUT) PLATFORM=$(PLAT) RELEASE=$(RELEASE) + +devicemodel: + cd $(T)/devicemodel; \ + make DM_OBJDIR=$(DM_OUT) clean; \ + make DM_OBJDIR=$(DM_OUT) + +tools: + mkdir -p $(TOOLS_OUT) + cd $(T)/tools/acrnlog; \ + make OUT_DIR=$(TOOLS_OUT); + cd $(T)/tools/acrn-manager; \ + make OUT_DIR=$(TOOLS_OUT); + cd $(T)/tools/acrntrace; \ + make OUT_DIR=$(TOOLS_OUT); + +.PHONY: clean +clean: + rm -rf $(ROOT_OUT) + + + diff --git a/tools/acrn-manager/Makefile b/tools/acrn-manager/Makefile index fe9f1b062..53f8bcaef 100644 --- a/tools/acrn-manager/Makefile +++ b/tools/acrn-manager/Makefile @@ -1,5 +1,8 @@ + +OUT_DIR ?= . + all: acrnctl.c - gcc -o acrnctl acrnctl.c -I../../include -Wall -g + gcc -o $(OUT_DIR)/acrnctl acrnctl.c -I../../devicemodel/include -Wall -g clean: rm -f acrnctl diff --git a/tools/acrnlog/Makefile b/tools/acrnlog/Makefile index 9bad49cb4..ea5bf09d2 100644 --- a/tools/acrnlog/Makefile +++ b/tools/acrnlog/Makefile @@ -1,5 +1,8 @@ + +OUT_DIR ?= . + all: - gcc -g acrnlog.c -o acrnlog -lpthread + gcc -g acrnlog.c -o $(OUT_DIR)/acrnlog -lpthread clean: rm acrnlog diff --git a/tools/acrntrace/Makefile b/tools/acrntrace/Makefile index 1b03c0278..e62ec2e31 100644 --- a/tools/acrntrace/Makefile +++ b/tools/acrntrace/Makefile @@ -1,5 +1,8 @@ + +OUT_DIR ?= . + all: - gcc -o acrntrace acrntrace.c sbuf.c -I. -lpthread + gcc -o $(OUT_DIR)/acrntrace acrntrace.c sbuf.c -I. -lpthread clean: rm acrntrace