Tools Makefiles: enhancement to keep source code tree clean

Running 'make' will leave 3 files in the source code tree that
are not cleaned by a subsequent 'make clean'. These are:
* tools/acrn-crashlog/acrnprobe/include/version.h
* tools/acrn-crashlog/usercrash/include/version.h
* tools/acrn-manager/acrn_mngr.o
(as reported by 'git status' after 'make')

This patch changes the location of these files so they are
created in the target build directory and hence properly
cleaned when running 'make clean'

Other minor changes to the Makefiles include:
* Remove BASEDIR by the built-in CURDIR variable
* Add .PHONY targets

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
Geoffroy Van Cutsem
2018-06-01 10:32:07 +02:00
committed by lijinxia
parent 84f4cf3c1d
commit 7f2a7d47dd
3 changed files with 47 additions and 32 deletions

View File

@@ -1,21 +1,24 @@
OUT_DIR ?= .
.PHONY: all
all: $(OUT_DIR)/libacrn-mngr.a $(OUT_DIR)/acrnctl
$(OUT_DIR)/libacrn-mngr.a: acrn_mngr.c acrn_mngr.h
$(CC) -c acrn_mngr.c -DMNGR_DEBUG -I../../devicemodel/include -Wall -g
ar -cr $@ acrn_mngr.o
$(CC) -c acrn_mngr.c -DMNGR_DEBUG -I../../devicemodel/include -Wall -g -o $(OUT_DIR)/acrn_mngr.o
ar -cr $@ $(OUT_DIR)/acrn_mngr.o
cp ./acrn_mngr.h $(OUT_DIR)/
$(OUT_DIR)/acrnctl: acrnctl.c
$(CC) -o $(OUT_DIR)/acrnctl acrnctl.c -I../../devicemodel/include -Wall -g
.PHONY: clean
clean:
rm -f $(OUT_DIR)/acrnctl
rm -f acrn_mngr.o
rm -f $(OUT_DIR)/acrn_mngr.o
rm -f $(OUT_DIR)/libacrn-mngr.a
.PHONY: install
install: $(OUT_DIR)/acrnctl
install -d $(DESTDIR)/usr/bin
install -t $(DESTDIR)/usr/bin $(OUT_DIR)/acrnctl